View Full Version : need help with ajax loading

08-22-2008, 06:24 AM
hi all, i have an AJAX script, here is the code:

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
catch (e){
page_request = new ActiveXObject("Microsoft.XMLHTTP")
catch (e){}
return false
loadpage(page_request, containerid)
page_request.open('GET', url, true)

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {


it show dynamic content in special ID of one of web element (in DIV tag for example)

but when connection is low... sometime need more time thant just 1 or 2 seconds for load this content..

and i want to edit this script like this:
while 3 seconds i want to display message "please wait..." in that element ID...
but i don't know how to edit this one...

so please help me.. how can i do that..?

thanks a lot.. : )

08-24-2008, 01:15 PM
is that hard what i asked or what? help me :(

08-24-2008, 02:57 PM
I'm not usre if I understand you, but I think what you could do is change the content of the div tag with

document.getElementById("Your div tag").innerHTML="Please wait...";

then execute your Ajax script, then when it is finished change the div tag to whatever you want.

I'm not sure if that is at all what you want, but I did my best :)