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/