Jquery可排序更新事件只能调用一次?

我正在尝试使用Jquery& amp; PHP的.我没问题.我的问题是,当调用update事件时,它返回2个结果.拖动父项的1个结果,Dropped Parent的一个结果.我想只打电话给父母的身份.这是我的脚本:

$("#gallery ul").sortable({
    connectWith: '.dropBox',opacity: 0.35,scroll: true,scrollSensitivity: 100,//handle: '.move',helper: 'clone',containment:'#gallery',accept:'#gallery > .photo',revert: true,update: function(event,ui){
        params = 'c=' + $(this).attr('id') + '&id=' + ui.item.attr('id');

        $.ajax({
            type: 'POST',url: 'processData.PHP',data: params,error:function(){
                alert("Error!");
            },success:function(data){
                $("#serverResponse").html(data);
            }
        });
    }
}).disableSelection();

你能帮帮我们吗?

最佳答案
例如,使用更新,停止和接收事件

$(function() {
    position_updated = false; //flag bit

    $(".sortable").sortable({
        connectWith: ".sortable",ui) {
            position_updated = !ui.sender; //if no sender,set sortWithin flag to true
        },stop: function(event,ui) {
            if (position_updated) {

                //code

                position_updated = false;
            }
        },receive: function(event,ui) {
            // code
        }

    }).disableSelection();
});

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...