当帖子失败时,您会调用哪个jQuery AJAX事件?例如,如果站点记录此消息:
POST http://s-t-h-c.appspot.com/dispatch 500 (Internal Server Error)
哪个AJAX事件处理程序处理它?例如,如果请求成功,我们可以使用:
$.ajax({
success: function() {
}
});
我已经尝试了error:
和ajaxError:
,但他们似乎无法解决问题。
任何帮助将不胜感激!谢谢!
〜Carpetfizz
答案 0 :(得分:1)
同样添加success:
,ajax中有error:
作为示例代码,我将在此处发布一个
$.ajax({
type: 'GET',
dataType: 'json',
url: url,
timeout: 5000,
success: function(data, textStatus ){
alert('request successful');
},
error: function(xhr, textStatus, errorThrown){
alert('request failed');
}
});
干杯!
答案 1 :(得分:0)
$.ajax(
{
type: "GET",
cache: false,
url: url,
dataType: "xml",
contentType: "text/html",
success: processData,
error: errorAlert
}); //end of AJax
//Package the code that handles
//error message in case the request
//is not successful:
function errorAlert(e, jqxhr)
{
alert("Your request was not successful: " + jqxhr);
}