jQuery ajaxSend() Methode

❮ jQuery AJAX-Methoden

Beispiel

Ändern Sie den Inhalt eines <div>-Elements, wenn eine AJAX-Anforderung gesendet werden soll:

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

Definition und Verwendung

Die Methode ajaxSend() gibt eine Funktion an, die ausgeführt werden soll, wenn eine AJAX-Anforderung gesendet werden soll.

Hinweis: Ab jQuery Version 1.8 sollte diese Methode nur noch an document angehängt werden.


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

❮ jQuery AJAX-Methoden