jQuery ajaxError() Yöntemi

❮ jQuery AJAX Yöntemleri

Örnek

Bir AJAX isteği başarısız olduğunda bir uyarı kutusunu tetikleyin:

$(document).ajaxError(function(){
  alert("An error occurred!");
});

Tanım ve Kullanım

ajaxError() yöntemi, bir AJAX isteği başarısız olduğunda çalıştırılacak bir işlevi belirtir.

Not: jQuery 1.8 sürümünden itibaren bu yöntem yalnızca belgeye eklenmelidir.


Sözdizimi

$(document).ajaxError(function(event,xhr,options,exc))

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

Kendiniz Deneyin - Örnekler


kullanın Daha kullanışlı bir hata mesajı almak için options parametresi nasıl kullanılır?


❮ jQuery AJAX Yöntemleri