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

posted @ 2018-01-16 01:12  EasonJim  阅读(4146)  评论(0编辑  收藏  举报