我想使用新功能 (http://api.jquery.com/jQuery.ajax) 对 http 状态代码(如 200、201 或 202)做出反应。但该函数忽略了我的 201 和 202 回调。
firefox-4.0_b10 和 chromium-9.0 会出现此错误
我期待着解决这个小问题。
问候斯特凡
我的代码片段:
jQuery.ajax({
url: url,
dataType: 'json',
statusCode: {
404:function() { alert("404"); },
200:function() { alert("200"); },
201:function() { alert("201"); },
202:function() { alert("202"); }
},
success: function(data){
switch(data.status) {
case 'done':
/* display it to the User */
break;
}
});
解决方案如下:
jQuery.ajax({
url: url,
dataType: 'json',
statusCode: {
404:function() { alert("404"); },
200:function() { alert("200"); },
201:function() { alert("201"); },
202:function() { alert("202"); }
}/*,
success: function(data){
switch(data.status) {
case 'done':
/* display it to the User */
break;
}
}*/
});
不知何故,成功方法与 httpStatusCode-Map 冲突
问候斯特凡
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)