Metoda jQuery ajaxSend().

❮ Metody jQuery AJAX

Příklad

Změňte obsah prvku <div>, když se má odeslat požadavek AJAX:

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

Definice a použití

Metoda ajaxSend() určuje funkci, která se má spustit, když se má odeslat požadavek AJAX.

Poznámka: Od verze jQuery 1.8 by tato metoda měla být připojena pouze k dokumentu.


Syntax

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

Parameter Description
function(event,xhr,options) Required. Specifies the function to run if the request succeeds
Additional parameters:
  • event - contains the event object
  • xhr - contains the XMLHttpRequest object
  • options - contains the options used in the AJAX request

❮ Metody jQuery AJAX