码迷,mamicode.com
首页 > Web开发 > 详细

ajax

时间:2015-09-29 22:08:09      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:

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()

ajax

标签:

原文地址:http://www.cnblogs.com/sunzgod/p/4847351.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!