Metoda jQuery ajaxSend()

Metody jQuery AJAX

Przykład

Zmień zawartość elementu <div>, gdy żądanie AJAX ma zostać wysłane:

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

Definicja i użycie

Metoda ajaxSend() określa funkcję do uruchomienia, gdy ma zostać wysłane żądanie AJAX.

Uwaga: od wersji 1.8 jQuery ta metoda powinna być dołączona tylko do dokumentu.


Składnia

$(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