Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to achive a ause functionality in javascript.

I am making an asynchronous AJAX call and trying to achive synhronous functionality of AJAX. I want to pause the javascript until i receive the AJAX response for the asyn call of AJAX. Due to some reason i am not using the AJAX synchronous call which will solve my problem.

Once i make a call i use the following two functions to pause the JS

function pause2(numberMillis) {
var dialogScript = "window.setTimeout(" +
" function () { document.write(' '); window.close(); }, "
+ numberMillis + ");";
var result = window.showModalDialog('javascript.document.writeln(' +
'"<script>' + dialogScript + '<' + '/script>")');
}

function pause3()
{

do
{
if(lmsCommitTimeOut<9000){
lmsCommitTimeOut=lmsCommitTimeOut+1000;
pause2(1000);
}
else
{
//alert("TimeOut");
lmsCommitStatus="false";
return;
}

}while(readStateAchived=="false")

}

I call the pause3(); function which internally calls the pause2(1000) for every 1sec until i get the ajax response back, which i check with the help of a js variable "readStateAchived".

This is working well in IE6, but in IE7 it is poping up the modal window and not getting closed, I have to close it manually.

Can anyone help me with this?

Thank you.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900