js中同步与异步请求方式

异步请求方式:

$.ajax({
url : 'your url',
data:{name:value},
cache : false,
async : true,
type : "POST",
dataType : 'json/xml/html',
success : function (result){
do something....
}
});

同步请求方式:

$.ajax({
url : 'your url',
data:{name:value},
cache : false,
async : false,
type : "POST",
dataType : 'json/xml/html',
success : function (result){
do something....
}
});

posted @ 2016-07-01 11:15  蚂蚁1  阅读(10245)  评论(0编辑  收藏  举报