.ajaxSend()The .ajaxSend() method in jQuery is used to attach a function to be executed before an Ajax request is sent.
.ajaxSend() syntax.ajaxSend(handler)
handler is a function to call before the ajax request sent.
.ajaxSend() exampleHTML
<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>" );
});
