我正在尝试使用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();
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。