$('ul#list').sortable({ axis: 'y', update: function() { const order = $('ul#list li') .map(function() { return $(this).data('id'); }) .get(); $.post('/api/sort', { order }); } });