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

http://blog.csdn.net/tianyinlove/article/details/7242732

http://blog.csdn.net/djy180/article/details/36685469

原文地址:https://www.cnblogs.com/EasonJim/p/8291742.html