Disable completion buttons during ajax calls to back-end

This commit is contained in:
Junior 2026-11-22 14:21:02 -05:00
parent 7cf29a7607
commit 445dae586e

View File

@ -103,6 +103,8 @@ function deleteTask() {
function setTaskCompleteState(complete = TASKCOMPLETE) {
if ( $("#form_id").val() == "0" ) return;
$("#form_complete").prop("disabled", true);
$("#form_incomplete").prop("disabled", true);
$.ajax({
url: 'ajax/task-setcomplete.php',
type: 'POST',
@ -123,6 +125,10 @@ function setTaskCompleteState(complete = TASKCOMPLETE) {
},
error: function(jqo, stat, error) {
toastr.error("Could not communicate with server!", "Server Error");
},
complete: function() {
$("#form_complete").prop("disabled", false);
$("#form_incomplete").prop("disabled", false);
}
});
}