0

如何将序列化日期与带有 jquery 的数组合并为 ajax post?

例如,

var array = { name: "John", time: "2pm" };

$.post( "page.php", $("form").serialize() + array);

我明白了,

Array
(
    [url] => another test
    [page_id] => 140
    [method] => update[object Object]
)

我该怎么做才能合并它们并将其作为下面的结果?

Array
(
    [url] => another test
    [page_id] => 140
    [method] => update
    [name] => John
    [time] => 2pm
)
4

1 回答 1

1

用于$.param()序列化数组/对象

var array = { name: "John", time: "2pm" };

$.post( "page.php", $("form").serialize() + '&' + $.param(array));
于 2013-09-30T15:03:23.310 回答