.on( "ajaxStart", handler )Returns: jQuery
Description: Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
-
version added: 1.7.on( "ajaxStart", handler )
ajaxStart
event. For the deprecated .ajaxStart()
method, see .ajaxStart()
.
ajaxStart
event. Any and all handlers that have been registered with .on( "ajaxStart", ... )
are executed at this time.
1
2
3
|
|
1
2
3
|
|
1
2
3
|
|
trigger
and the Ajax request is sent, the log message is displayed.
Additional Notes:
-
As of jQuery 1.9, all the handlers for the jQuery global Ajax events, including those added with
.on( "ajaxStart", ... )
, must be attached todocument
. -
If
$.ajax()
or$.ajaxSetup()
is called with theglobal
option set tofalse
, theajaxStart
event will not fire.
Example:
1
2
3
|
|