English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The ajaxStart() method attaches a function to be executed when an Ajax request starts. This is an AjaxEvent.
Every time an AJAX request is about to be sent, jQuery checks if there are any other pending AJAX requests. If there are none in progress, jQuery triggers the ajaxStart event. At this point, all handlers registered with the ajaxStart() method will be executed.
Note:From jQuery 1.8Since version X, this method should only be attached to the document.
$(document).ajaxStart(function())
Display the "Loading" icon when the AJAX request starts:
$(document).ajaxStart(function(){ $("div").html('<i class="fa fa-spinner fa-pulse fa-5x"></i>'); });Test See‹/›
Parameters | Description |
---|---|
function() | Specify a function to run when the AJAX request starts |