My js code does POST order.php?order[]=1&order[]=2&order[]=3&order[]=4&order[]=5&&action=update How to reverse it to order.php?order[]=5&order[]=4&order[]=3&order[]=2&order[]=1&&action=update ?
JavaScript:
order=[];
//var reversed = $(this).sortable("serialize").split("&").reverse().join("&");
//var order = reversed + '&action=update'; //unfortunately it does not work so
$('#list ul').children('li').each(function(idx, elm) {
order.push(elm.id.split('-')[1])
});
$.post('order.php', {'order[]': order, action: 'update'});
HTML:
<ul>
<li id="oreder-5">5</li>
<li id="oreder-4">4</li>
<li id="oreder-3">3</li>
<li id="oreder-2">2</li>
<li id="oreder-1">1</li>
<ul>