English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery ajaxSend() method

jQuery AJAX Methods

The ajaxSend() method specifies the function to be executed before sending an Ajax request. This is an AjaxEvent.

When an Ajax request is about to be sent, jQuery triggers the ajaxSend event. At this time, all handlers registered with the ajaxSend() method will be executed.

Note:From jQuery 1.8Since version, this method should only be attached to the document.

Syntax:

$(document).ajaxSend(function(event, xhr, options))

Example

Display a message before sending an Ajax request:

$(document).ajaxSend(function(event, xhr, options){
  alert("Requesting: " + options.url);
});
Test See‹/›

Parameter Value

ParametersDescription
function(event, xhr, options)Specify a function to be executed before the Ajax request is sent

Parameters:

  • event -Contains event object

  • xhr-Contains XMLHttpRequest object

  • options-Contains options used in AJAX requests

jQuery AJAX Methods