如何在jQuery UI sortable上发送属性的序列化键?
首先,我需要发送属性数据名称,排序如下:如何在jQuery UI sortable上发送属性的序列化键?,jquery,jquery-ui,Jquery,Jquery Ui,首先,我需要发送属性数据名称,排序如下: /sorting?firstname=0&lastname=1&email=2&country=3 这是我的密码: $("#sortable").sortable({ revert: true, axis: 'y', stop: function(event, ui) { var data = $(this).sortable('toArray', { attrib
/sorting?firstname=0&lastname=1&email=2&country=3
这是我的密码:
$("#sortable").sortable({
revert: true,
axis: 'y',
stop: function(event, ui) {
var data = $(this).sortable('toArray', {
attribute: 'data-name'
});
$.ajax({
data: data,
type: 'GET',
url: '/sorting'
});
}
});
$("#draggable").draggable({
connectToSortable: "#sortable",
helper: "clone",
revert: "invalid"
});
怎么做
第二,当我将项“draggempty”拖到列表中时,我需要发送排序,而不需要它们。例如,我需要跳过它们。例:
/sorting?firstname=0&lastname=1&email=3&country=4
“拖空”在lastname之后,则电子邮件和国家/地区具有排序+1
下面是代码示例:
相同转换的可能重复对于这个问题,只需反转idx和值的位置:为什么不使用内置序列化选项并相应地更新后端。。。?