Reputation: 537
I want to ask the user to confirm if he really wants to sort the list here is my code
<script language="javascript">
$(document).ready(function () {
$("#menu-pages").sortable({
update: function (event, ui) {
var didConfirm = confirm("Are you sure you want to Update the Navigation?");
if (didConfirm == true) {
$.post("ajax.php", {
type: "orderPages",
pages: $('#menupages').sortable('serialize')
});
}
}
});
});
</script>
Yes it doesnt send the ajax script but it dont go back to its original position.
Upvotes: 0
Views: 237
Reputation: 272066
You can call event.preventDefault()
inside the update callback to revert item to its original position.
Upvotes: 1