Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在jQuery UI sortable上发送属性的序列化键?_Jquery_Jquery Ui - Fatal编程技术网

如何在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和值的位置:为什么不使用内置序列化选项并相应地更新后端。。。?