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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM