Using AJAX to fetch pages

Discussion in 'Programming' started by iM1, Jul 8, 2008.

  1. #1
    I need a script that can grab pages via ajax and keep reloading the page every 10 seconds (or any other time i set).

    Does anyone know the script for this?
     
    iM1, Jul 8, 2008 IP
  2. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What pages? I mean, where the pages are located? How exactly do you wanna display those pages? Why ajax? Maybe an iframe will do the job just fine.

    I can ask tons of questions if you don't specify exactly what you need :)
     
    xlcho, Jul 9, 2008 IP
  3. iM1

    iM1 Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I would like to load wwwDOTim1musicDOTnetSLASHonline-users101 (sorry i had to do that because it wouldnt let me add the link), but from three different sites. So theres actually three of them i need to load.

    I thought AJAX would be best to use because you dont have to refresh the page and what not, I dont know for sure whats the best way. At the moment I actually am using iframes to do it, I think AJAX will be better because instead of me constantly pressing refresh all the time it will update it for me.
     
    iM1, Jul 9, 2008 IP
  4. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can use
    <iframe id='myiframe' src='http://google.com' onload="setTimeout('refresh()', 60000);"></iframe>
    Code (markup):
    where refresh is something like:
    function refresh()
    {
      document.getElementById('myiframe').src = document.getElementById('myiframe').src;
    }
    Code (markup):
    Really no need to use ajax here
     
    xlcho, Jul 9, 2008 IP
  5. mbreezy

    mbreezy Active Member

    Messages:
    135
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #5
    If you use AJAX it's going to be pretty much the same thing. You'll just use a <div> instead of an <iframe>.

    There would be some slight changes, but I think the swift way to do it is with iframes. All AJAX is good for is just updating segments of server-side content - like a login or something. Of course other uses, but not the most efficient.
     
    mbreezy, Jul 9, 2008 IP
  6. haomie

    haomie Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    simple GET method using AJAX
     
    haomie, Jul 10, 2008 IP