Yes, there are better ways. Instead of def index(): return dict(link = A('clickme',_href=URL('plus_minus')))
def plus_minus(): do_something() redirect(URL('index')) You can do def index(): return dict(link = A('clickme', callback=URL('plus_minus'))) def plus_minus(): do_something() # no more redirect(URL('index')) (and plus_minus will be called via ajax) You can also do: def index(): return dict(link = A('clickme', callback=URL('plus_minus'),target='test'), div = DIV(_id='test')) def plus_minus(): do_something() return "this text will go in target DIV#test" so that you capture the response of the ajax too. On Thursday, 6 December 2012 15:38:18 UTC-6, jonas wrote: > > hi > > I have a controller that basically inserts a number in a database. I don't > want it to render any view. For now I just redirect back to index.html, but > is there any other way to do it, i.e to have a controller that not renders > any views? > > controller: > > def plus_minus(): > > """ add or subtract likes """ > > post=db(db.blog.id==request.args(0)).select().first() > db.plus_minus.pm_id.default=post.id > db.plus_minus.insert(plus=1) > db.commit() > > redirect(URL('index')) > > --