save jquery ui-sortable positions to DB

前端 未结 4 609
北恋
北恋 2020-12-24 00:53

Im trying to replicate the functionality of this page (http://www.kissfm.ro/fresh-top-40/) for a friend who has a small web radio. The site is setup in wordpress fyi.

<
4条回答
  •  忘掉有多难
    2020-12-24 01:29

    According to the Sortable docs we have to prefix the LI's id with some string. Then if we serialize the sortable in the update method we'll get a nice array in php e.g. new_order[]=1&new_order[]=2 etc.

    var data = $(this).sortable('serialize');
    
    
    • elem 1
    • elem 2
    • elem 3
    • elem 4

提交回复
热议问题