I'm using jQuery UI's sortable lists to sort items in a todo list, and the reordering of the lists works like a charm.
I have several UL lists for each todo category, i.e. Design, Development, etc.
I want to be able to move an item from one category to another, and jQuery UI's sortable lists plugin allows me to do this with the connectWith option parameter.
But I can't seem to find how to update the database as well. The todo database table has a field for a reference to the category which is laying in it's own table.
This is the current code:
$('.sortable').sortable({
axis: 'y',
opacity: .5,
cancel: '.no-tasks',
connectWith: '.sortable',
update: function(){
$.ajax({
type: 'POST',
url: basepath + 'task/sort_list',
data: $(this).sortable('serialize')
});
}
});
Do I need to add another value to the AJAX's data parameter, or do the sortable plugin this for me in the serialize function?