jQuery ajaxSuccess() Metode

❮ jQuery AJAX-metodes

Voorbeeld

Aktiveer 'n waarskuwingskassie wanneer 'n AJAX-versoek suksesvol voltooi is:

$(document).ajaxSuccess(function(){
  alert("AJAX request successfully completed");
});

Definisie en gebruik

Die ajaxSuccess()-metode spesifiseer 'n funksie wat uitgevoer moet word wanneer 'n AJAX-versoek suksesvol voltooi is.

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


Sintaksis

$(document).ajaxSuccess(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

Probeer dit self - voorbeelde


Hoe om die opsies parameter te gebruik om die funksie te beperk tot AJAX versoeke vir 'n spesifieke lêer.


❮ jQuery AJAX-metodes