Refreshing a page with AJAX

Discussion in 'JavaScript' started by blueparukia, Aug 25, 2007.

  1. #1
    I want to refresh a page every 5 seconds. What is the script to do that.

    Thanks

    BP
     
    blueparukia, Aug 25, 2007 IP
  2. mamina

    mamina Active Member

    Messages:
    316
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Not AJAX.

    You would do it this way...

    
    <html>
    <head>
    <meta http-equiv="refresh" content="5">
    </head>
    </html>
    
    Code (markup):
    Now the problem with this is that the server returns a 200 (page OK)... this can be used by BlackHat SEO's to get more 'inbound' links to their page by having a lot of different sites with a refresh of '0' all going to one place.

    There are other ways to do refreshes with PHP, ASP, JAVASCRIPT, ColdFusion, etc... that would be a better example... but for the very simple, the META tag is the way to go.
     
    mamina, Aug 25, 2007 IP
  3. rldowling03

    rldowling03 Notable Member

    Messages:
    1,763
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    200
    #3
    Will that refresh just one area of a page?? no it won't, anyone who has an ajax code that would do this as i'm interested
     
    rldowling03, Aug 25, 2007 IP
  4. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #4
    <script type="text/javascript">
    function refreshme(){
    window.location='ifr.htm';
    }
    setTimeout("refreshme()",1);
    </script>
    Code (markup):
     
    blueparukia, Aug 25, 2007 IP