Results 1 to 8 of 8

Thread: Javascript/Ajax - Adding a Loader

  1. #1
    Join Date
    Feb 2010
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Javascript/Ajax - Adding a Loader

    Hey Guys,

    How would you add a loader to
    http://www.dynamicdrive.com/dynamici...jaxcontent.htm
    Like so when it is loading the content it has an image saying loading or something.

    Thanks.

  2. #2
    Join Date
    Feb 2010
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Can anyone at all help ?

  3. #3
    Join Date
    Feb 2010
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I really need help.. Like putting this in (but I don't know where to put it and make it work)

    $('').innerHTML = "<center><img src=''images/loading.gif"></center>";

  4. #4
    Join Date
    Feb 2010
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    These forums are useless, Haven't even got a reply..

  5. #5
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try replacing:
    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
    }
    With:
    Code:
    function loadpage(page_request, containerid){
    if (page_request.readyState <= 3){
      document.getElementById(containerid).innerHTML="Loading...";
    }
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=page_request.responseText
    }
    Jeremy | jfein.net

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

    Lemon (03-10-2010)

  7. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Well... I've replied - and no response?
    Jeremy | jfein.net

  8. #7
    Join Date
    Feb 2010
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    Try replacing:
    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
    }
    With:
    Code:
    function loadpage(page_request, containerid){
    if (page_request.readyState <= 3){
      document.getElementById(containerid).innerHTML="Loading...";
    }
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=page_request.responseText
    }
    That's exactly what I wanted!

    Thank you so much!!!

  9. #8
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Glad to help you! Your welcome!

    It seems your topic is solved... Please set the status to resolved.. To do this:
    Go to your first post ->
    Edit your first post ->
    Click "Go Advanced" ->
    Then in the drop down next to the title, select "RESOLVED"
    Jeremy | jfein.net

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
  •