Easy Tutorial
❮ Sel Input Reset Misc Param ❯

jQuery ajaxSend() Method

jQuery AJAX Methods

Example

Change the content of the <div> element when an AJAX request is about to be sent:

$(document).ajaxSend(function(e, xhr, opt){
    $("div").append("<p>Requesting: " + opt.url + "</p>");
});

Definition and Usage

The ajaxSend() method specifies a function to be run when an AJAX request is about to be sent.

Note: As of jQuery version 1.8, this method can only be attached to the document.


Syntax

Parameter Description
function(event, xhr, options) Required. Specifies the function to be run when the request is successful. <br> Additional parameters: <br> event - Contains the event object <br> xhr - Contains the XMLHttpRequest object <br> options - Contains the options used in the AJAX request

jQuery AJAX Methods

❮ Sel Input Reset Misc Param ❯