need help with ajax loading
hi all, i have an AJAX script, here is the code:
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){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {
document.getElementById(containerid).innerHTML=page_request.responseText
}
}
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.. : )