Posted By

secretgspot on 03/23/11


Tagged

autorefresh


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

telemichus


In-Page Element Updating/Refreshing


 / Published in: jQuery
 

Essentially it refreshes the content of any element in the page that has the “autoupdate” class on it. It uses the jQuery AJAX load method to get the page and replaces all the content within the new content from their matching IDs.

  1. if ($('.autoupdate')[0]) {
  2. setInterval(function () {
  3. $.get(document.location, function (data) {
  4. $('.autoupdate').each(function () {
  5. var html = $(data).find('#' + $(this).id).html();
  6. });
  7. });
  8. }, 10000);
  9. }

Report this snippet  

You need to login to post a comment.