Jquery的同步和异步请求操作
1 ,异步请求:
$.ajax({ url : 'your url', data:{name:value}, cache : false, async : true, type : "POST", dataType : 'json/xml/html', success : function (result){ do something.... } }); $.post( 'your url', {name:value}, function(data) { do something... }, 'json/xml/html' );
2,同步请求:async : false
$.ajax({ url : 'your url', data:{name:value}, cache : false, async : false, type : "POST", dataType : 'json/xml/html', success : function (result){ do something.... } });