I have two lists
<ul class="sortable" id="list-A">
<li id="1">Value 1 </li>
<li id="2">Value 2 </li>
<li id="3">Value 3 </li>
</ul>
<ul class="sortable" id="list-B">
<li id="4">Value 1 </li>
<li id="5">Value 2 </li>
<li id="6">Value 3 </li>
</ul>
connected like this
$( ".sortable" ).sortable({
connectWith: '.sortable',
placeholder: "widget-highlight"
});
i knew how to save a one ordered list to database by saving the order
but how to save if the user moves an item from list a to list b ?
i want to save the item position but how
Using
.sortable()‘s.receive()callback, get the dropped node’s.index()viaui.item.index(). How you process it in PHP will depend on how your ajax handler is setup.The above example will send the dropped node’s new list position in
$_POST['newPosition']The events are fully described in the
.sortable()API documentation