oh woe.. thanks for trying to understand tho... ok so yes teh user fill out a form and the Ajax sends the result of the form to a function that updated the db.. after the function updates the database i want to to redirect it to another page.. the problem is teh function for teh page is being called but the default view is not loaded to the screen
On May 7, 12:36 pm, pbreit <pbreitenb...@gmail.com> wrote: > I'm very confused as to what you are trying to do. Are your users filling > out a form? Do you really need the JavaScript? What are you trying to do > exactly? > > To link between pages, you simply do this (similar > tohttp://web2py.com/book/default/chapter/03#Say-My-Name): > > === default.py === > def a(): > return dict() > > def b(): > return dict() > > === default/a.html === > {{extend 'layout.html'}} > <a href="{{=URL('b')}}">go to b</a> > > === default/b.html === > {{extend 'layout.html'}} > <p>This is b.</p> > > If users fill out a form, you do something like this: > > === default.py === > def a(): > form=FORM('Your name:', > INPUT(_name='name', requires=IS_NOT_EMPTY()), > INPUT(_type='submit')) > if form.accepts(request.vars, session): > session.flash = 'form accepted' > redirect(URL('b')) > elif form.errors: > response.flash = 'form has errors' > else: > response.flash = 'please fill the form' > return dict(form=form) > > === default/a.html === > {{extend 'layout.html'}} > {{=form}} > > === default/b.html === > {{extend 'layout.html'}} > <p>This is b.</p>