On Friday, March 23, 2012 12:54:00 AM UTC-4, weheh wrote: > > Anthony, I tried your > raise HTTP(200, response.render()) > vs. my > raise HTTP(200, SCRIPT(response.js)) > > I ran into a ticket complaining about my form not being defined, so > I'm back to my SCRIPT(). >
Well, by default response.render() renders the current view (which in this case is login.load). Instead, you can tell it to render a different view (either change response.view, or just pass the name of the view as the first arg to response.render()). But if you don't actually need to render any view, then there's no need to include response.render() at all. In that case, just do: raise HTTP(200) Your response.js code will get added to the response headers, and the web2py JS code on the client will execute the response.js code when the Ajax response is received (this assumes the Ajax request was made via a web2py component). Note, when the web2py component receives the Ajax response, it replaces the component contents with the returned response, which in this case will be emtpy -- so your component will end up empty. Is that what you want? Shouldn't the response include some kind of "You are now logged in" message? Anthony On Friday, March 23, 2012 12:54:00 AM UTC-4, weheh wrote: > > Anthony, I tried your > raise HTTP(200, response.render()) > vs. my > raise HTTP(200, SCRIPT(response.js)) > > I ran into a ticket complaining about my form not being defined, so > I'm back to my SCRIPT(). > > Traceback (most recent call last): > File "N:\web2py\gluon\restricted.py", line 204, in restricted > exec ccode in environment > File "N:\web2py\applications\myapp\views\user/login.load", line 9, > in <module> > }} > NameError: name 'login_form' is not defined

