I am having this particular problem: When I drop a draggable onto a droppable and then delete this draggable (The draggables are "files and folders" and the droppable is "Trash Bin"), inside the callback of the "drop event", javascript falls to endless loop. My exact code is:
$("#trash").droppable({
over : function () {$("#trash").addClass("over")},
out : function () {$("#trash").removeClass("over")},
drop : function (e, ui) {
$("#trash").removeClass("over");
var id=$($(ui.draggable).parent()).attr("id"), fl=false;
$($(ui.draggable).parent()).hide();
$(".ui-draggable-dragging").remove();
if (id[1]=='l') {
fl=true;
id=flid(id);
}else{
id=fid(id);
}
$.post("ajax/recycle_file.php", {fid : id, folder : fl}, function (data) {
var elid=$($(ui.draggable).parent()).attr("id");
$("#"+elid).draggable("destroy");
$("#"+elid).remove(); //Here is where the endless loop starts
});
}
});
The message I get from the javascript console of Google Chrome is:
Uncaught TypeError: Cannot read property 'options' of undefined