jQuery .ajaxStart()
Learn all about the jQuery function .ajaxStart().
Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the ajaxStart
event. Any and all handlers that have been registered with the .ajaxStart()
method are executed at this time.
To observe this method in action, set up a basic Ajax load request:
1
2
3
|
|
Attach the event handler to any element:
1
2
3
|
|
Now, make an Ajax request using any jQuery method:
1
2
3
|
|
When the user clicks the element with class trigger
and the Ajax request is sent, the log message is displayed.