How can I use jquery to refresh a div?

Discussion in 'jQuery' started by mikey1090, Jun 28, 2012.

Thread Status:
Not open for further replies.
  1. #1
    Hi guys

    I'm using jquery to load content into a <div> called content. I use this to dynamically load my pages.

    One of the pages is a shoutbox. I need to autorefresh the shoutbox so it works like a chatroom/facebook chat. As the shoutbox is dynamically loaded, document.ready() doesn't work.

    How can I refresh content inside a <div> that was populated using AJAX. Also, how can I autorefresh this every 10 seconds or whatever?

    Thanks,
    Mike
     
    mikey1090, Jun 28, 2012 IP
  2. Custom IDX/MLS

    Custom IDX/MLS Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Think AJAX. Something along the lines of
    
    $(document).ready(function() {
      $("#our-div").load('/shoutbox/file.php?p=arameters);}, 1000);
      $.ajaxSetup({ cache: false });
    });
    
    Code (markup):
    where 1000 being your refresh rate.
     
    Custom IDX/MLS, Jun 28, 2012 IP
  3. igunz

    igunz Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    nice question and nice answer. i neet it too.. :)
    thanks
     
    igunz, Jul 10, 2012 IP
Thread Status:
Not open for further replies.