troyd1
asked on
javascript cannot show a wait layer while doing ajax
I am trying to popup a message that says getting data, please wait..... in a div(mess) that I am making visible and then when the ajax call is done, I want to hide the message div(mess) and display the results in a display div(disp). The problem is that it only updates the screen after the ajax call. If I do not rehide the message div, they both show up after the ajax call. What do I need to do to fix this? I have also tried to update the innerhtml just for the disp div and it will only show the final assignment. I also tried breaking it into multiple functions, but that did not help.
Here is my code:
function showfonts(){
document.getElementById("m ess").styl e.left = document.body.scrollLeft+2 00;
document.getElementById("m ess").styl e.top = document.body.scrollTop+50 0;
document.getElementById("m ess").styl e.visibili ty = 'visible';
document.getElementById("d isp").styl e.left = document.body.scrollLeft;
document.getElementById("d isp").styl e.top = document.body.scrollTop;
document.getElementById("d isp").styl e.visibili ty = 'visible';
var DATETIME = new Date().getTime();
arg = 'someajaxcall'
if (window.XMLHttpRequest) {objHTTP = new XMLHttpRequest()} else
{
if (window.ActiveXObject){obj HTTP = new ActiveXObject("Msxml2.XMLH TTP")} else {objHTTP = new ActiveXObject("Microsoft.X MLHTTP")}
}
objHTTP.open("GET", arg, false);
objHTTP.send('');
tvar = objHTTP.responseText.subst ring(objHT TP.respons eText.inde xOf('<HTML >')+6,objH TTP.respon seText.ind exOf('</HT ML>'));
document.getElementById("d isp").inne rHTML = tvar;
document.getElementById("m ess").styl e.visibili ty = 'hidden';
return;
}
Here is my code:
function showfonts(){
document.getElementById("m
document.getElementById("m
document.getElementById("m
document.getElementById("d
document.getElementById("d
document.getElementById("d
var DATETIME = new Date().getTime();
arg = 'someajaxcall'
if (window.XMLHttpRequest) {objHTTP = new XMLHttpRequest()} else
{
if (window.ActiveXObject){obj
}
objHTTP.open("GET", arg, false);
objHTTP.send('');
tvar = objHTTP.responseText.subst
document.getElementById("d
document.getElementById("m
return;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, Troy