maybe you'll be better off with a component (LOAD()) for that On Saturday, December 8, 2012 5:00:41 PM UTC+1, jonas wrote: > > Thanks, that solved the callback problem. now I just have to figure > how to update part of the index.html view. > > On Sat, Dec 8, 2012 at 4:25 PM, Niphlod <[email protected] <javascript:>> > wrote: > > use the power, Luke! > > you have something like this > > A(TAG.i(_class="icon-thumbs-up"), _rel="tooltip", _title="you like > this", > > _class="btn", _href=URL("plus",args=result.id)) > > and you can turn it into a callback using > > A(TAG.i(_class="icon-thumbs-up"), _rel="tooltip", _title="you like > this", > > _class="btn", callback=URL("plus",args=result.id)) > > > > > > On Saturday, December 8, 2012 3:42:49 PM UTC+1, jonas wrote: > >> > >> Hi > >> > >> I still have some problems with callbacks. I have a like button that is > in > >> my index.html view that add 1 to a database, then displays it: > >> > >> <a class="btn" href={{=URL("plus",args=result.id)}} rel="tooltip" > >> title="you like this"><i class="icon-thumbs-up"></i></a> > >> > >> I want to call the plus function as a callback to avoid render another > >> view, i.e I want to render the result in the index view, but I don't > know > >> how to replace it in the above format. I also have to send the id to > the > >> callback. > >> > >> the function: > >> > >> def plus(): > >> > >> """ add or subtract likes """ > >> print "called",request.args(0) > >> db(db.blog.id==request.args(0)).update(plus=db.blog.plus+1.0) > >> db.commit() > >> > >> # redirect(URL('index')) > >> > > -- > > > > > > >
--

