I'm trying to make my form stay on the same page using jquery. I'm using a form named #clientUpdate-form that posts it's input to update.php. I have tried removing the window.location.href and tried changing it to window.location.href="edit_form.php?edit_id="+edit_id but the form always reverts back to index.php
Full Code:
/* Update Record */
$(document).on('submit', '#clientUpdate-form', function() {
$.post("update.php", $(this).serialize()).done(function(data) {
$("#dis").fadeOut();
$("#dis").fadeIn('slow', function() {
$("#dis").html('<div class="alert alert-info">' + data + '</div>');
$("#clientUpdate-form")[0].reset();
$("body").fadeOut('slow', function() {
$("body").fadeOut('slow');
window.location.href = "index.php";
});
});
});
return false;
});
/* Update Record */