我今天和sortable一起工作,有点卡住了。
我正在尝试获取新的父节点ID,以便在ajax请求中使用。
编辑:我现在让它记录父级,但它只是在数组中为所有父级添加相同的父级ID。
$('.portlet-row').sortable({
connectWith: ".portlet-row",
update: function(e, ui) {
var imageids_arr = [];
var listids_arr = [];
$('.portlet').each(function(){
var id = $(this).attr('id');
var split_id = id.split("_");
imageids_arr.push(split_id[1]);
var ids = $(e.target).attr('id');
var split_ids = ids.split("_");
listids_arr.push(split_ids[1]);
});
$.ajax({
url: 'sorts.php',
type: 'post',
data: {imageids:imageids_arr, listids: listids_arr},
success: function(response){ }
});
}
});
$('.portlet-row').disableSelection();