setTimeout?

jQuery.fn.ajaxUpdater = function(url, interval){
   var self = this;
   function update(){
     $.getJSON(url+'?'+(+new Date), function(data){
         self.text( $(data).find('item') );
         setTimeout(update, interval);
     });
   };
   update();
});

$('#myEl').ajaxUpdater('bla.json', 2000);

(appending date to avoid caching)

On Jun 15, 12:50 pm, jwerd <lamerh...@gmail.com> wrote:
> I'm grabbing an update from a json file, but I want to have it update
> perodically to the screen, overwriting what it found before... sort of
> like Prototype's Ajax Updater.  Is this possible in Jquery?  I scoured
> the groups to but only found a digg spy thing, which is sort of what
> I'm looking for but it was dated for 2007, so there's gotta be
> something new or is that it?
>
> Please help.  TIA
>
> Jake

Reply via email to