Created
November 29, 2017 09:37
-
-
Save snobu/7c89efb38fcd2bcdb5867d15e87f28fe to your computer and use it in GitHub Desktop.
Show spinner on ajax request (jQuery)
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
| $.ajax({ | |
| url: "destination url", | |
| success: ..., | |
| error: ..., | |
| // shows the loader element before sending. | |
| beforeSend: function () { | |
| $("#imgSpinner1").show(); | |
| }, | |
| // hides the loader after completion of request, whether successfull or failor. | |
| complete: function () { | |
| $("#imgSpinner1").hide(); | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment