The best way is the following: in the view:
<a href="#" onclick="ajax('{{=URL('change_n')}}',[],':eval');return false">click me to increment n</a> than create a controller action def change_n(): # check this was called by the ajax post if request.env.request_method=='POST': # do anything you need to do session.n=session.n+1 # optional return instructions in JS return "$('.flash').html('n was incremented').slideDown();" In the view: ajax('...url...',[],':eval');return false the url is the url of the callback action. [] is a list of optional input names whose values you want to pass along. :eval tells web2py the response will be in JS. return false prevents the browser from reloading the page on click. On Dec 17, 6:56 pm, Rick <sababa.sab...@gmail.com> wrote: > Hi, > > I want to change the value of a variable by clicking on an <a> tag, > but can't find any information about the topic. I suppose the code > would look something like this: > > {{=A('<', request ???? n=n-1) }} > > Thanks in advance for help