I am using jQuery prompt to prompt a user to save. So, a user clicks a Save button, the Jquery prompt displays and asks if the user is sure he/she wants to save changes or not. The problem is, the user is able to click multiple times on the jQuery Save prompt button before the prompt closes. As a result, my save routine runs once for each time the prompt save button is clicked, which results in duplicate records in the database. I need to disable the prompt save button on the first click or simply close the prompt window on the first click to prevent multiple saves. How can I do this?
Client code:
$.prompt("Are you sure you want to save? You will not be able to change your decision after it's been saved.", {
title: "Save?",
buttons: { "Save": true, "Cancel": false },
submit: function (e, v, m, f) {
if (v) {
response = saveUpdates(LoanDetails);
}
}
});