Results 1 to 3 of 3

Thread: need help with ajax loading

  1. #1
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.. : )

  2. #2
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    is that hard what i asked or what? help me

  3. #3
    Join Date
    Jul 2008
    Posts
    65
    Thanks
    42
    Thanked 0 Times in 0 Posts

    Default

    I'm not usre if I understand you, but I think what you could do is change the content of the div tag with
    Code:
    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •