<button onclick="document.location='{{=URL (r=request,f='sayhi')}}';">click me</button>
On Apr 5, 4:45 pm, waTR <roman.goldm...@gmail.com> wrote: > Your last post did answer my question, though, the code didn't work. > > <button onclick="{{=URL(r=request,f='sayhi')}}">click me</button> > > when you click it will call the action sayhi(), For example > > def sayhi(): return dict(message="hello") > > The button does not redirect to the other page when clicked... > > On Apr 5, 7:04 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > The book on lulu.com should cost $12. > > > On Apr 5, 5:03 am, Steve Shepherd <sargs...@gmail.com> wrote: > > > > Where did you find the book in pdf format for under $20? > > > You should look at the the following code that allows a callback without > > > updating the page. This would be great for a calculator. > > > >def index(): > > > button1=TAG.BUTTON(_onclick="$.ajax({url: '%s', success: function > > > (value) { $('#target').html(value); } });" % URL > > > (r=request,f='callback')) > > > div1=DIV(_id='target') > > > return dict(button1=button1, div1=div1) > > > > class callback(): > > > return H1('Hello world').xml() > > > fixed a typo in code above. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---