Skip to content

Instantly share code, notes, and snippets.

@mikhailov
Created August 25, 2010 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mikhailov/548933 to your computer and use it in GitHub Desktop.
Save mikhailov/548933 to your computer and use it in GitHub Desktop.
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