jQuery Tutorial Tutorials - jQuery .ajaxStart()

jQuery .ajaxStart()

The .ajaxStart() method in jQuery is used to register a handler to be called when the first Ajax request begins.

jQuery .ajaxStart() syntax

.ajaxStart(handler)

handler is a function to call when the first Ajax request begins.

jQuery .ajaxStart() example

example

HTML

<button id="ajaxReq">Ajax Request</button>
<div id="result"></div>
<div id="msg"></div>

jQuery

$( "#ajaxReq" ).click(function() {
    $( "#result" ).load( "/res/test/ajax/1.html" );
});
$( document ).ajaxStart(function() {
    $( "#msg" ).append( "<p>Triggered ajaxStart handler:before sending</p>" );
});

Try now

Date:2019-08-30 02:43:01 From:www.Lautturi.com author:Lautturi