I have a page with multipe jquery sortable lists, each of these lists has an sp_id, how do I pass this to my script?
<script type="text/javascript">
$(function() {
$(".sortable").sortable({ opacity: 0.6, cursor: 'move', update: function() {
var order = $(this).sortable("serialize", "placeholder") + '&action=updateRecordsListings&sp_id=' + ???;
$.post("updatedb.php", order, function(order) {
alert(order);
});
}
});
});
I am guessing I should put a sp_id field of some kind in each sortable ul
<ul class="sortable"
-- ?? Some field with the sp_id ?? --
<li class="ui-state-default">Item 1</li>
<li class="ui-state-default">Item 2</li>
</ul>
Put that in a document ready or click function? or if your rending your HTML including the .sortable element just add that to the ul. Guess it all depends on how your working with what, from what end.
to get the value for posting via jQuery..
Alternatively you could also get the index of each on load and append them similar to the LI’s.
then when you post to your ajax you run a similar function over all of them to get all there spid values. It can get really intricate if you let it hope it helps