ajax...

Discussion in 'Web Design and Development' started by jlewis2k1, May 27, 2006.

  1. jlewis2k1 macrumors 6502a

    jlewis2k1

    Joined:
    Jan 14, 2005
    Location:
    in your closet
    #1
    ok so i have looked at numerous tutorials and im trying to figure out how to get my little ajax script to auto update like every 30 or so seconds... any ideas?
     
  2. angelneo macrumors 68000

    Joined:
    Jun 13, 2004
    Location:
    afk
    #2
    Have you tried using setInterval or setTimeout?
     
  3. jlewis2k1 thread starter macrumors 6502a

    jlewis2k1

    Joined:
    Jan 14, 2005
    Location:
    in your closet
    #3
    i have tried settimeout, it wont even execute at all. and isnt setInterval a function to set speeds and all?
     
  4. jlewis2k1 thread starter macrumors 6502a

    jlewis2k1

    Joined:
    Jan 14, 2005
    Location:
    in your closet
    #4
    ok so i got it to kind of work with

    Code:
    <script>
    window.setInterval("ahah('Live/lefcon','lefcon')", 2000);
    </script>
    but its not updating. how can i get it to clear its cache so it can retrieve the current data?
     
  5. Thom_Edwards macrumors regular

    Joined:
    Apr 11, 2003
    #5
    posting the whole script might help more. and what leads you to believe you need to clear cache? also, you say it's kind of working but it won't update. i thought the whole purpose of this was to get it to update. how is just kind of working?

    you might also want to use a javascript debugger. google it and it will come. there is a really good one for firefox. it is an invaluable tool for all but the most basic javascript implementations.
     
  6. angelneo macrumors 68000

    Joined:
    Jun 13, 2004
    Location:
    afk
    #6
    Just another word of advice, if you are using https connection, together with dynamically generated XML. You might want to set the header to no-cache as there is a problem with caching of XML document especially using Windows IE
     
  7. jlewis2k1 thread starter macrumors 6502a

    jlewis2k1

    Joined:
    Jan 14, 2005
    Location:
    in your closet
    #7
    i would post the source code but i forgot it at my parents :-( so i have to start from scratch :-\
     
  8. dr0wnoutthen0is macrumors newbie

    Joined:
    May 17, 2004
    Location:
    Palo Alto, CA
    #8
    If this is happening in IE for Windows, then you might want to include a random query string on the end of your URL that you call every so many seconds. I had a similar problem and IE for Windows is dumb and caches the first XML response unless you do this. So add "?rand=123456789" or something to the URL (which is different every time you call it) for your XMLHttpRequest or do what someone else said and try the <meta> tags for caching and such.
     

Share This Page