Jquery的同步和異步請(qǐng)求操作
1 ,異步請(qǐng)求:
$.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,同步請(qǐng)求:async : false
$.ajax({ url : 'your url', data:{name:value}, cache : false, async : false, type : "POST", dataType : 'json/xml/html', success : function (result){ do something.... } });