Okay
  Public Ticket #890048
Refreshing DIV with JS
Closed

Comments

  •  1
    Jack started the conversation

    Hi,


    I'm trying to refresh the div that contains my blog posts at a set interval (45 seconds) so that any new posts that are added will update automatically without the user having to refresh the page.

    Currently I'm using this JS:

    <code>


       <script>
     function autoRefresh_div()
     {
          $("#blogposts-640157d68828b8f6e").load("load.html");seconds
      }

      setInterval('autoRefresh_div()', 45000); // refresh div after 45 secs
                </script>


    </code>

    ... but it doesn't seem to be working, i.e the div doesn't refresh.

    Please can you provide me with a working solution to refresh the posts container?


    Thanks in advance,

    Best Regards,

    Jack Vanstone

  • [deleted] replied

    Hi Jack,

    The blog posts widget changes the ID each refresh so you should not refer with id #blogposts-640157d68828b8f6e but rather than that, use class name to properly fill the div.