So I have a sortable li
list that has a series of pages displayed.
When I sort them, my jQuery code calls a php page that updates the order of my pages in the database.
On the same page as the list, it displays the pages in the order they are in but I want to be able to auto update this order right after my database is updated without actually refreshing the page.
So basically, secretly "refresh" the pageContainer
div.
What is the best way to do this?
<div id="pageContainer">
<!-- include() a series of pages in the right order from database -->
</div>
$("#pageContainer").sortable({
stop : function(event, ui){
var postData = $(this).sortable('serialize');
var url = "saveOrder.php";
$.ajax({
type: "POST",
url: url,
data: postData,
success: function(data) { $('#pageContainer').html(data); }
});
}
});
EDIT
So a simple $('#pageContainer').html(data);
did the trick but my $('form').on('input propertychange change')
stopped working. The fix is on this page if anyone wants to look.