Hi, i have discovered quite an odd behaviour of jquery. I have two lists here, where i drag and drop li-elements from one to another, the current sortings is being saved by ajax-mysql. Now this afternoon i noticed that sometimes, just sometimes the position of the last dropped item wasnt saved properly, it was saved as "0" when it should be for example 4 or 5. Took me some hours to find out that this behaviour is in direct relation to the alert, that is triggered after a drop of an item:
alert(data); <---- data is the current sorting of the ids
If i remove this line, then the above described odd behaviour of the script appears. Maybe someone has experienced something like this before and can share some advise?
greets, Maschek
edit: This is the function, that contains the alert:
$(function() {
$("#sortable2").sortable({
items: \'li:not(.col_header)\',
connectWith: \'#sortable2, #sortable1, #sortable1b, #sortable1c\',
helper: \'clone\',
placeholder: \'empfaenger-highlight\',
revert: \'invalid\',
update: function() {
var data = $(this).sortable("serialize") + \'&user='.$user.'\';
alert(data);
var order = $(this).sortable("serialize") +
\'&action=updateList&user='.$user.'\';
$.post("index.php?eID=moveitems", order,
function(theResponse){
$("#response").html(theResponse);
$("#response").slideDown(\'slow\');
slideout();
});
}
}).disableSelection();