Partial page refresh.

Discussion in 'JavaScript' started by Jen-, Apr 14, 2007.

  1. #1
    Its important I find a refresh to just one part of a page. Namely to refresh a div instead of a whole page. Anyone know what kind of scripting can cause a partial page refresh? Already googled nothing found yet. I don't need buttons or hrefs to cause a refresh, I need an automatic fresh after so much time. I can figure the timer part and div id info out, I just need to know how to cause a partial page refresh, or if it can even be done.

    For instance this causes a full page refresh. <BODY onLoad=window.setTimeout("location.href='http://www.website.com/page.html'",600000)> Can I apply this to a div ID instead without using a full refresh? If not javascript, somethinge else?
    Please let me know, thank you very much....
     
    Jen-, Apr 14, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    There are several methods to do that, mainly AJAX and DHTML.
    What kind of content do you want to put in the DIV ?, and
    What actions are going to launch the content change ?, time, user clicks, cursor movement, server changes, ...
     
    ajsa52, Apr 14, 2007 IP
  3. Jen-

    Jen- Peon

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the open mind, time is what will be used to trigger the refresh. I don't think ajax will work unless you can pull a refresh to a div with it. I know how to use ajax, I just haven't seen anything for it causing a refresh to part of the page.

    I just want the server to read part of the page because part of the page will be using some sort of server side script. Not sure which server side I'll be using yet, just depends on what I find out about this refresh situation. I have many server side scripts I'd like to use on the page. The full refresh moves the whole page too much.
     
    Jen-, Apr 15, 2007 IP
  4. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Yes, you can do it with AJAX. Take a look at Ajax.Updater Class from prototype.js

    Another option could be using iframes and changing the "src" with javascript.
     
    ajsa52, Apr 15, 2007 IP
  5. Jen-

    Jen- Peon

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'm not optimistic with Ajax but thanks for the help and I'll definitely read through it, thanks Ajsa
     
    Jen-, Apr 15, 2007 IP
  6. Jen-

    Jen- Peon

    Messages:
    151
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for the great link. The prototype updater is interesting. I'm still reading up on it. The down news is it still want to load things into the div instead of just refreshing whats in the div. If refreshes can happen by sending info back and forth, there must be a way, to just do a refresh only, without sending info back and forth. If anyone knows of some leads please let me know, thanks!
     
    Jen-, Apr 18, 2007 IP