ajax失败和错误之间的区别?
在使用ajax时,我熟悉error,它用于抛出运行ajax函数时发生的任何错误,那么为什么要使用failure呢ajax失败和错误之间的区别?,ajax,Ajax,在使用ajax时,我熟悉error,它用于抛出运行ajax函数时发生的任何错误,那么为什么要使用failure呢 $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: 'Webstore.aspx/FetchSlider',
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: 'Webstore.aspx/FetchSlider',
data: '{"_CompanyId":' + _CompanyId + ',"_ShopId":' + _ShopId + '}',
dataType: "json",
success: function (data) {
-- code
},
failure: function (msg) {
-- code
},
error: function (msg) {
-- code
}
});
我查看了jQuery文档,没有找到与失败相关的api。您确定jQuery公开了一个名为failure的API回调吗?换句话说,您确定在ajax请求失败时调用失败回调吗