Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
automatically show/hide ajax-spinner + disable/enable submit buttons
var spinner = $('#ajax-spinner');
$(document).ajaxSend(function() {
$('input[type=submit]').attr('disabled', 'disabled');
$('#warningBox').hide();
spinner.show()
}).ajaxStop(function() {
$('input[type=submit]').removeAttr('disabled');
spinner.hide()
});
$("form").submit(function(){
$('input[type=submit]').attr('disabled', 'disabled');
return true;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment