Jquery sortable('serialize')

前端 未结 6 1549
遥遥无期
遥遥无期 2021-02-01 08:57

Is it possible to get the serialized list of items from a UL in jquery by calling the serialize method directly instead of using a callback? The code snippet:

va         


        
6条回答
  •  攒了一身酷
    2021-02-01 09:58

    I finally got the answer! You need to make the UL sortable first before calling the serialize method on it:

    var sortableLinks = $("#category_links_list_3");
    $(sortableLinks).sortable();
    var linkOrderData = $(sortableLinks).sortable('serialize');
    

    This time linkOrderData contains category_link[]=8&category_link[]=9

提交回复
热议问题