Created
April 22, 2013 03:52
-
-
Save TravelingTechGuy/5432343 to your computer and use it in GitHub Desktop.
Show a spinner when starting a jQuery AJAX call, and hide when the call is done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document) | |
.ajaxSend(function() { | |
$('#spinner').show(); | |
}) | |
.ajaxStop(function() { | |
$('#spinner').hide(); | |
}) | |
.ajaxError(function() { | |
$('#spinner').hide(); | |
$('#message').text('Error occurred'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment