1
JavaScript & JScript / После первого действия скрипт перестает работать
« : 05 Июня 2010, 11:58:27 »
Возникла одна проблема. Вот скрипт который делает сортировку у перетаскивание с добавлением в базу, проблема в том что после первого действия скрипт перестаёт работать, после первого запроса уже не отсылается и не работает сортировка, вроде firebug ничего не показал
Код: [Выделить]
var dropped = false; var templateHtml; $(document).ready(function(){ function addlist(param) { $.ajax({ url: \'index.php\', data: \'drop=\'+encodeURIComponent(param), type: \'POST\', dataType: \'php\', success: function(msg) { if(parseInt(msg)!=0) { $(\'#pageContent\').html(msg); } } }); } setSortable(); $("#droppable").droppable({ accept:".drop", drop:function(event,ui){ dropped = true; addlist(ui.draggable.text()); } }); }); function setSortable(){ $("#sortable").sortable({ opacity: 0.6, cursor: \'move\', update: function() { var order = $(this).sortable("serialize") + \'&action=listing\'; $.post("index.php", order, function(theResponse){ $("#pageContent").html(theResponse); }); } }); $("#sortable li").addClass("drop").bind(\'mousedown\',function(){ templateHtml = $("#sortable").html(); }); }
Код: [Выделить]
- One
- Two
- Three
- Four
- Five
- Six