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