JQurey中getJSON方法错误回调方法
1、使用try...catch实现
2、换$.ajax
3、JQuery 1.5+可以这样使用:
$.getJSON("example.json", function() {
alert("success");
})
.success(function() { alert("second success"); })
.error(function() { alert("error"); })
.complete(function() { alert("complete"); });
参考:
https://stackoverflow.com/questions/1740218/error-handling-in-getjson-calls

浙公网安备 33010602011771号