jQuery ajaxSend() Method

jQuery ajaxSend() method to be called before the AJAX request sent.

When an Ajax request is sent, jQuery triggers the ajaxSend event.


Here is a syntax for ajaxSend() method

$(selector).ajaxSend( function(event, jqXHR, options) );
Parameter Type Description
function(event, jqXHR, options) Function Required. A specifies callback function to be run before the AJAX request sent.
Additional parameters
  • event - contains standard event object
  • jqXHR - contains the XMLHttpRequest object
  • options - contains plain object used in the AJAX request


    <p>Ajax is use to jQuery to open URL documents with in the documents</p>
    <br />
    <p>AJAX = Asynchronous JavaScript and XML</p>

Here, in this example ajaxSend() method call when click on button.

<!DOCTYPE html>
  <title>jQuery ajaxSend() event method</title>
  <script src="jquery-latest.min.js"></script>
    $(document).ready(function() {
      $(document).ajaxSend(function(event, jqXHR, options){
        $("#send").text("Requesting file: " + options.url );
  <p id="send"></p>
  <button>Click here to call ajaxSend() method</button>
  <br /><br />
  <div id="msg" style="background-color:pink;">New content updates here</div>

Run it...   »