How to use ajaxSend() Method in JQuery AJAX

In this article, I will explain use of ajaxSend() Method in JQuery AJAX.
  • 3458

Query AJAX ajaxSend() Method

  • ajaxSend() method add a function to run when an AJAX requests is about to be sent.
  • ajaxSend() method is a AJAX Event.



function(event,xhr,options)  The function is run when the request is fail.

  • event - Event parameter contains the event object.

  • xhr - xhr parameter contains the XMLHttpRequest object.

  • options - option parameter contains the options used in the AJAX request.



The following example show the use of ajaxSend() method.


<!DOCTYPE html>



<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("div").ajaxSend(function (e, xhr, opt) {

            $(this).html("Requesting " + opt.url);


        $("button").click(function () {







<div><h2>ajaxSend() method example</h2></div>

<button>click for send request</button>





You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2018 DotNetHeaven. All rights reserved.