Blair, Klaus, thanks for the help.  I was able to use your code with minor modifications.

 

As a followup question, when I use the $("#report").load("bentonite.cfm?dataType=html") syntax, the report div is not expanding to fit the content of the data being returned; it’s always just 1 em tall.  If I use the .ajax syntax as I originally posted, it does expand to fit.  Strange?  Common?

 

Thanks again

 

Paul

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Blair McKenzie
Sent: Tuesday, September 19, 2006 12:21 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Request from a newbie

 

Better :)

On 9/19/06, Klaus Hartl <[EMAIL PROTECTED]> wrote:



Blair McKenzie schrieb:
> function refreshData() {
> $("#report").load("bentonite.cfm?dataType=html"); // Loads the page via
> ajax and puts content into specified elements
> return false;
> };
>
> $(function() { // $(fn) == $(document).ready(fn)
> refreshData();
> setTimeout(refreshData(), 3000);
> $(refreshlink).click(refreshData);
> });

You need setInterval... here's my attempt:

var interval;

function refreshData() {
     if (interval) clearInterval(interval);
     $("#report").load("bentonite.cfm");
     interval = setInterval(refreshData, 3000);
     return false;
};

$(function() {
     refreshData();
     $(refreshlink).click(refreshData);
});

A manual refresh resets the interval update here.

I think a periodic updater would make a nice little plugin. Maybe it is
even option for some future version of jquery to have another option for
$.ajax like:

periodic: 3000


-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

 

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to