jQuery ajaxSend() Metode

❮ jQuery AJAX-metodes

Voorbeeld

Verander die inhoud van 'n <div>-element wanneer 'n AJAX-versoek op die punt staan ​​om gestuur te word:

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

Definisie en gebruik

Die ajaxSend()-metode spesifiseer 'n funksie wat uitgevoer moet word wanneer 'n AJAX-versoek op die punt staan ​​om gestuur te word.

Let wel: Vanaf jQuery weergawe 1.8 moet hierdie metode slegs aan dokument geheg word.


Sintaksis

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