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
