Ajax 异步请求新理解

alert(1);

              SniperDialog.show(node,"dialogHeight:300px;dialogWidth:660px;resizable:yes;scroll:no;status:no;help:no;");

              var options = {method : 'GET',parameters:'method=findFileType2&bargainId=${bargain.id}&bargainType=2&tstmp=' + new Date().getTime()};

              alert(2);

 new Ajax.Updater($('fileContentDivType'),'bargainAccessory.do?',options);

              alert(3);

 

SniperDialog.show 是模式窗口 ,它会等到响应完才执行后面的语句。

 

 

 

new Ajax.Updater($('fileContentDivType'),'bargainAccessory.do?',options);  是异步操作,所以服务器反应结果前可以执行后面的代码

即输出 alert(2),之后立即输出alert(3);

你可能感兴趣的:(Ajax)