我要对此代码执行的操作是发送订单(序列化的POST数据)以及另外一个包含类别/群集/列表ID的POST数据。
以下是代码:
$(function () {
$("[id^=sortable-]").sortable({
connectWith: ".sortable",
update: function () {
$("[id^=sortable-]").each(function(index, element) {
var order = $(this).sortable('serialize');
var clusterid = $(this).attr("id").replace("sortable-","");
order.push({cluster: clusterid});
alert("Order: " + order + "\nCluster: " + cluster); //Just showing update
$.ajax({
data: order,
type: 'POST',
url: '/ajax.php'
});
});
}
}).disableSelection();
});
所以基本上我使用多个列表,其中可排序的项目是可互换的,我想在一次数据事务中发送列表/集群ID以及该列表的顺序。
但是,我不知道使用正确的语法。我真的不知道如何描述我在技术方面要做的事情,所以不确定要搜索什么。
尝试推送数据会给我这个错误:
Uncaught TypeError: Object comp[]=1&comp[]=3&comp[]=2&comp[]=4&comp[]=5 has no method 'push'