Ste*_*fan 5 ajax jquery http-status-codes jquery-1.5
我想用新功能(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;
}
});
小智 2
解决方案如下:
jQuery.ajax({
网址: 网址,
数据类型:'json',
状态代码:{
404:函数(){警报(“404”); },
200:函数(){警报(“200”); },
201:函数(){警报(“201”); },
202:函数(){警报(“202”); }
}/*,
成功:函数(数据){
开关(数据.状态){
案例“完成”:
/* 显示给用户 */
休息;
}
}*/
});
不知何故,成功方法与 httpStatusCode-Map 冲突
问候斯特凡
| 归档时间: |
|
| 查看次数: |
2308 次 |
| 最近记录: |