$(window).load(function () {
$("table").sortable({
items: "div",
opacity: 0.6,
cursor: 'move',
update: function (event, ui) {
var order = $('#form1').serialize();
$.ajax({
type: "POST",
url: "Default7.aspx/Update",
data: "{'NewOrder': '" + order + "'}",
dataType: "json",
contentType: "application/json"
});
}
});
});
[System.Web.Services.WebMethod]
public static void Update(string NewOrder)
{
}
how can i alert the newly sorted rows?
Try this:
$(document).ready(function () {
$("table").sortable({ items: "div", opacity: 0.6, cursor: 'move', update: function (event, ui) {
var order = $('#form1').serialize();
$.ajax({
type: "POST",
url: "Default7.aspx/Update",
data: {"NewOrder" : order },
dataType: "json",
contentType: "application/json",
success:function(){// add success callback function to sort row
// add you code to sort the table
// or call $('table').sortable() again
}
});
}
});
});