Looks like you have specified a relative URL in the ajax() function, which 
simply gets appended to the URL of the current page, so instead of making 
the Ajax request to /default/aj1, the request is going to 
/default/index/aj1. You should use the URL helper instead:

ajax('{{=URL('default', 'aj1')}}',[],'t')

See if that helps.


On Sunday, July 19, 2015 at 11:10:16 AM UTC-4, [email protected] 
wrote:
>
> 2.11.2.11.2-stable+timestamp.2015.05.30.16.33.24
> (Running on Rocket 1.2.6, Python 2.7.9)
>
> please test:
> # -*- coding: utf-8 -*-
>
> from time import sleep
>
> def aj1():
>     session.t = (session.t or 0) + 1
>     sleep(2)
>     return 'OK %s. Click once more!' % session.t
>
>
> def index():
>     h = CAT(
>         FORM(
>             BUTTON('Test', 
> _onclick="ajax('aj1',[],'t');$('#t').html('testing...');"),
>             _action="javascript: void(0);"
>             ),
>         DIV(_id='t'), # target
>         )
>     
>
>     return dict(h = DIV(h, _class='container'))
>
>
> when click - button id "Working..." and not restored ((
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to