jQuery: What to do with the list that sortable('serialize') returns?

前端 未结 8 1503
我寻月下人不归
我寻月下人不归 2020-12-23 20:01

With jQuery I\'m retrieving positions of a sortable list using \'serialize\', like this:

var order = $(\'ul\').sortable(\'serialize\');

The vari

8条回答
  •  抹茶落季
    2020-12-23 20:33

    Solution

    I have created my own solution by manipulating sortable('serialize'). I have simplified it by using jquery functions, and then posted it to php url for updating order of list in the database. Have a look at my code.

    $( "#covercast_sortable" ).sortable({
            update : function () { 
                var order = $('#covercast_sortable').sortable('serialize',{key:'string'}); 
                // order var gives something like string=3&string=2&string=1
                var ar = order.split('&');
                var i = 0;
                var str = '';
                for(i;i
                    
                    0
                  
                       
                    
                   讨论(0)
                  
                                                      
                  
                  
提交回复
热议问题