Here's what I'm using: # controller def login():
On Mar 23, 7:30 pm, Sebastien Stormacq <[email protected]> wrote: > Hello Anthony, > > Could you share your code for modal login ? > I am beginning with web2py and would love to learn from that example. > > Thanks > > Seb > > > > > > > > On Friday, March 23, 2012 4:08:51 AM UTC+1, Anthony wrote: > > > @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

