标签:
1.
获取ajax异步请求的数据
function ajax() {
return $.ajax(...);
}
ajax().done(function(result) {
// code depending on result
}).fail(function() {
// an error occurred
});
2.中断ajax请求
var xhr = $.ajax({
type: "POST",
url: "some.php",
data: "name=John&location=Boston",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
//kill the request
xhr.abort()
标签:
原文地址:http://www.cnblogs.com/sunzgod/p/4847351.html