I have two ajax requests: One that starts a long running process and
one that fires every second to check the first request's progress.
PROBLEM: The ajax requests are running synchronously instead of in
parallel. Is this the result of threading in the cherrypy dev server
or is some global variable being locked and causing the requests to
queue? I know I have gotten this to work in the past. (using
clienttools.py)
progress = DIV(_id='progress')
def long_run():
callback1 = js.call_function(start_long)
callback2 = js.call_function(check_long)
page.ready(js.timer(callback2,1000))
btn = INPUT(_type='button',_onclick=callback1,_value='Start')
return dict(btn=btn,progress=progress)
def start_long():
import time
for i in range(0,10):
time.sleep(1)
session.progress = i
return jq(progress).html('Finished')()
def check_long():
return jq(longdiv).html(session.progress or 0)()
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.