ajax - jquery: auto reload/update page element? -


hey guys, want upgrade specific page element every minute.

i know how use jquery load() function reload element on page this.

    $('.mostliked').load("http://mypage.com" + " .mostliked >*", function() {         //callback     }); 

that works fine because .mostliked element in sidebar.

however need update element can not grab it's content other page in sidebar example.

var reload = 60000; setinterval(function() {

    $('ul.rating').each(function() {         //simply reload element every minute     })     //update sidebar widget     $('.mostliked').load("http://mypage.com" + " .mostliked >*", function() {         //callback     });  }, reload); 

how can solve problem?

thank you

check under heading "loading page fragments" on page: http://api.jquery.com/load/

in order "reload" ul.rating elements, need fetch current page in background (using load or method), , capture ul.rating elements , replace them in page javascript running on.

note: isn't best way this, better if have server size code return content need ul.rating elements, instead of issuing entire page request parsing out parts need.


Comments

Popular posts from this blog

c# - IMAP GMAIL getting folder list problem -

PHP proxy to get XML: problem with URL arguments -