jquery sortable save order in database 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: save sort order of jquery sortable
$('#element').sortable({
axis: 'y',
update: function (event, ui) {
var data = $(this).sortable('serialize');
$.ajax({
data: data,
type: 'POST',
url: '/your/url/here'
});
}
});