Jquery ui sortable serialize not working

I was looking for everything, and I can not find the answer. I cannot get sorting for sorting. All I get is null data p>

$(document).ready(function() {
    $("ul#sortable").sortable({
        update : function () {
            serial = $("ul#sortable").sortable("serialize");
            $.ajax({
                url: "sort_images_ajax.php",
                type: "post",
                data: serial,
                error: function(){
                    alert("theres an error with AJAX");
                },
                success: function(feedback){ $("#data").html(feedback); }
            });
        }

    });
});

Here is my html:

<ul id="sortable">
<li id="sort_1" class="ui-state-default">1</li>
<li id="sort_2" class="ui-state-default">2</li>
<li id="sort_3" class="ui-state-default">3</li>
</ul>

Since I am using jquery 1.4.2, I found this information here in Stack Overflow:

jQuery.ajaxSettings.traditional = true;

With or without this last part of the code, I cannot serialize it. Any suggestions?

+5
source share
2 answers

I have the same problem ... Apparently, calling the .sortable () method from inside its event handler function doesn't work ?!

PS: Instead of "updating" I think you should use the "stop" event.

0
source

. , ?

0

All Articles