send order of sortable jquery\ code example
Example 1: jQuery UI Sortable, then write order into a database
$('#element').sortable({
axis: 'y',
update: function (event, ui) {
var data = $(this).sortable('serialize');
$.ajax({
data: data,
type: 'POST',
url: '/your/url/here'
});
}
});
Example 2: JQuery UI Saving Sortable List
$("#list").sortable({
update : function () {
var neworder = new Array();
$('#list li').each(function() {
var id = $(this).attr("id");
var obj = {};
obj[] = id;
neworder.push(obj);
});
$.post("pagewhereyouuselist.php",{'neworder': neworder},function(data){});
}
});