Skip to content

Commit

Permalink
Disable submit button until AJAX response returns
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviqv committed Jan 29, 2018
1 parent 6363d92 commit a2510c2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Views/shared/common.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
function ajax_form_submit(_this)
{
// Disable submit button until AJAX response has come
_this.prop('disabled', true);
var form = _this.closest('form');
var formData = new FormData(form[0]);
var errors_div = _this.data('errors_div');
Expand Down Expand Up @@ -72,8 +75,12 @@ function ajax_form_submit(_this)
$('#'+errors_div).hide();
if (response.url != ""){
window.location.href=response.url;
return false;
}
}
// Enable submit button
_this.prop('disabled', false);
}
});
}
Expand Down

0 comments on commit a2510c2

Please sign in to comment.