I'm using clienttools.py to put a timer on a page; the timer calls a
controller function (imaginatively called 'tick') every second, which in
turn updates a div on the page via Ajax. So far, so good.

I want the 'tick' controller function to be able to stop/disable the timer
under certain circumstances. I can do this interactively from a link that
results in the whole page being refreshed, but not from the tick function;
I think that's because the clienttools page.ready() function is only called
on initial page load, not from when an Ajax update completes.

Bits of code: to set up the timer:

        callback = js.call_function(tick)
        page.ready(js.timer(callback,1000))

...which works. Calling this from 'tick':

        page.ready(js.stop_timer(request.var.timer_id))

...doesn't stop the timer (the request.vars.timer_id is valid).

Is there a way of stopping the js timer from an Ajax call? Alternatively,
is there a better way of calling 'tick' to update a page every second?
-- 
"You can have everything in life you want if you help enough other people
get what they want" - Zig Ziglar. 

Who did you help today?

Reply via email to