S
stephen.durkin
I've gathered that javascript doesn't have a handy wait() function, so
I made the following function makeDelay() to make use of PHP's sleep(),
which then does the waiting, and responds with "done"...my problem is
that the javascript doesn't wait for makeDelay(seconds) to finish...?
makeDelay(5);
iDontWaitForNobody();
function makeDelay(seconds) {
url="make_delay.php?delay=" + seconds;
http.open("GET",url,true);
loadStatus=document.getElementById("loadStatus");
http.onreadystatechange=function() {
if (http.readyState==1) {
loadStatus.src="balls/load1.gif";
}
if (http.readyState==2) {
loadStatus.src="balls/load2.gif";
}
if (http.readyState==3) {
loadStatus.src="balls/load3.gif";
}
if (http.readyState==4) {
if(http.responseText == "done")
loadStatus.src="balls/load0.gif";
}
}
http.send(null);
}
I made the following function makeDelay() to make use of PHP's sleep(),
which then does the waiting, and responds with "done"...my problem is
that the javascript doesn't wait for makeDelay(seconds) to finish...?
makeDelay(5);
iDontWaitForNobody();
function makeDelay(seconds) {
url="make_delay.php?delay=" + seconds;
http.open("GET",url,true);
loadStatus=document.getElementById("loadStatus");
http.onreadystatechange=function() {
if (http.readyState==1) {
loadStatus.src="balls/load1.gif";
}
if (http.readyState==2) {
loadStatus.src="balls/load2.gif";
}
if (http.readyState==3) {
loadStatus.src="balls/load3.gif";
}
if (http.readyState==4) {
if(http.responseText == "done")
loadStatus.src="balls/load0.gif";
}
}
http.send(null);
}