The jQuery docs for code>.ajax
eror(jqXHR, textStatus, 误差Thrown)
A function to be called if the
request fails. The function receives three arguments: The jqXHR (in
jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of
error that occurred and an optional exception object, if one occurred.
Possible values for the second argument (besides null) are "timeout",
"error", "abort", and "parsererror". When an HTTP error occurs,
errorThrown receives the textual portion of the HTTP status, such as
"Not Found" or "Internal Server Error." As of jQuery 1.5, the error
setting can accept an array of functions. Each function will be called
in turn. Note: This handler is not called for cross-domain script and
JSONP requests.
您可使用.getJSON
。 例如:
$.getJSON("url?callback=?", function() {
//Success!
}).error(function() {
//Error!
});
<><>Edit>/strong>
象这样的景象也赢得了工作。 工作范围似乎是提供<条码>> 日码条码>选择<条码>。
$.ajax({
type: "GET",
url: http://google.com/adfdaf?callback=? ,
dataType: "jsonp",
timeout: 5000,
success: function (msg) {
console.log( Custom Domain validated successfully. );
},
error: function () {
console.log( Error occured while validating Custom Domain. );
}
});
显然,这并不理想,但错误的手稿将在5秒后运行。