我试图将数据添加到预序列化的数组中。它不起作用。有人发现原因吗?
$("#show-friends").live("click", function() {
var friendSelector = $("#jfmfs-container").data('jfmfs');
var sendArr = $(friendSelector).serializeArray();
sendArr.push({ name: "userid", value: "<?php echo $userId;?>" });
sendArr.push({ name: "fid", value: "<?php echo $fid;?>" });
$.post({
url:'test.php',
data: sendArr,
});
});
编辑:我将代码更改为:
$("#show-friends").live("click", function() {
var friendSelector = $("#jfmfs-container").data('jfmfs');
var sendArr = friendSelector.serializeArray();
$.post({
url:'test.php',
data: "name=<?php echo $userId;?>&fid=<?php echo $fid;?>&jsondata="+sendArr,
});
});
但是我收到错误friendSelector.serializeArray不是函数
答案 0 :(得分:1)