>
> @anthony: actually, on closer inspection, the doc does go into some
> details:
> http://web2py.com/books/default/chapter/29/4#HTTP-and-redirect<http://web2py.com/books/default/chapter/29/4#HTTP-and-redirect>
>
> but I'm still experimenting with how to get it to execute a script.
Something like:
def myonaccept(form):
[do stuff]
response.js = 'some JS code'
raise HTTP(200, response.render())
In that case, raise HTTP() will immediately return a response without
proceeding through the remainder of auth.login() (thus avoiding the
subsequent redirect). As long as the original request was made via an Ajax
component, setting response.js before calling raise HTTP() will result in
web2py adding the JS code as a response header before returning the
response.
Note, response.render() can take a view argument and a context argument
(i.e., a dict) if needed. HTTP() can also take arbitrary keyword arguments,
which will be converted to response headers.
Anthony