jQuery API | jQuery API 中英文对照版 |
ajaxError(callback) |
ajaxError(callback)
绑定一个当一个AJAX请求失败时执行的函数。 返回值:jQuery 参数:
示例: 显示一个请求失败的信息。 ("#msg").ajaxError(function(request, settings){ $(this).append("<li>Error requesting page " + settings.url + "</li>"); }); ajaxError( callback ) Attach a function to be executed whenever an AJAX request fails. The XMLHttpRequest and settings used for that request are passed as arguments to the callback. A third argument, an exception object, is passed if an exception occured while processing the request. Return value: jQuery
Example: Show a message when an AJAX request fails. $("#msg").ajaxError(function(request, settings){ $(this).append("<li>Error requesting page " + settings.url + "</li>"); }); |