Jquery sortable serialize returns empty string
HTML:
<ul id="categories_list" class="ui-sortable"> <li class="cat_row" style=""> item1 </li> <li class="cat_row" style=""> item2 </li> <li class="cat_row"> item3 </li> </ul>
JavaScript:
$("#categories_list").sortable({ placeholder: 'sortable_placeholder', update : function () { var order = $("#categories_list").sortable('serialize'); console.log(order); } });
order returns an "empty string", why is this?
+6
2 answers
The id ids on your li should look like this:
<ul id="categories_list" class="ui-sortable"> <li class="catRow_1" style=""> item1 </li> <li class="catRow_2" style=""> item2 </li> <li class="catRow_3"> item3 </li> </ul>
You need the order number to be separated by an underscore in accordance with here .
+15