jQuery Tutorial Tutorials - jQuery .ajaxSend()

jQuery .ajaxSend()

The .ajaxSend() method in jQuery is used to attach a function to be executed before an Ajax request is sent.

jQuery .ajaxSend() syntax

.ajaxSend(handler)

handler is a function to call before the ajax request sent.

jQuery .ajaxSend() 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 ).ajaxSend(function() {
    $( "#msg" ).append( "<p>Triggered ajaxSend handler:before sending</p>" );
});
$( document ).ajaxComplete(function() {
    $( "#msg" ).append( "<p>Triggered ajaxComplete handler</p>" );
});

Try now

Date:2019-08-30 02:41:29 From:www.Lautturi.com author:Lautturi