參考阮一峯的博客
$.ajax()操作,如果低於1.5.0版本
$.ajax({
url: "test.html",
success: function(){
alert("哈哈,成功了!");
},
error:function(){
alert("出錯啦!");
}
});
$.ajax()操作,如果高於1.5.0版本,返回的是deferred對象,可以進行鏈式操作。
$.ajax("test.html")
.done(function(){ alert("哈哈,成功了!"); })
.fail(function(){ alert("出錯啦!"); });