Results 1 to 6 of 6

Thread: Dynamic Ajax content : Wait message

  1. #1
    Join Date
    Dec 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic Ajax content : Wait message

    Dynamic Ajax content

    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    How can i add a waiting message while the page is loading ?
    I wont just to display and hidding a hidden DIV

    Thanks alot !

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Just find the lines:

    Code:
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    }
    and add beneath it something like:

    Code:
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    }
    document.getElementById(containerid).innerHTML='<b>Loading Content. Please hold...</b>'

  3. #3
    Join Date
    Dec 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks !

  4. #4
    Join Date
    Sep 2010
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    hello, I have added this code to my dynamic content script and I was wondering if there is a way to make it stay for say 1-2 seconds before the page loads? At the minute my pages are small so the loader flashes up for a millisecond, it would be nice for it to stay there so the user actually sees it.

    Thank you

    Helen

  5. #5
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Sure, try finding the following function inside the script:

    Code:
    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
    }

    and replace it with:

    Code:
    function loadpage(page_request, containerid){
    	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
    		if (typeof ajaxcontent_loadtimer!="undefined")
    			clearTimeout(ajaxcontent_loadtimer)
    		ajaxcontent_loadtimer=setTimeout(function(){document.getElementById(containerid).innerHTML=page_request.responseText}, 1000)
    	}
    }
    1000 in the above denotes 1 second (1000 milliseconds).
    DD Admin

  6. The Following User Says Thank You to ddadmin For This Useful Post:

    helenmarie123 (09-28-2010)

  7. #6
    Join Date
    Sep 2010
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    thats ace thank you very much

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
  •