开发者

Jquery ui sortable serialize not working

开发者 https://www.devze.com 2022-12-28 07:53 出处:网络
Searched all over and I can\'t find the answer.I can\'t get my sortable to serialize.All I\'m getting is null data

Searched all over and I can't find the answer. I can't get my sortable to serialize. All I'm getting is null data

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

    });
});

Here's 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'm using jquery 1.4.2, I found this piece of info here at Stack Overflow:

jQuery.ajaxSettings.traditional = true;

With or without that last piece of code, I can't get it to serialize. Any suggestions?


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

P.S.: Instead of "update" I think you should use "stop" event.


Is this all of your code. Is it possible that your IDs are not unique?

0

精彩评论

暂无评论...
验证码 换一张
取 消