The ajax() function must take a proper URL as the first argument. Your URL 
is just 'echo', which the browser interprets as being relative to the 
current page (because it doesn't start with a '/'). Instead, should be:

ajax('{{=URL('poptavka', 'echo')}}', [], 'target')

which will produce:

ajax('/yourapp/poptavka/echo', [], 'target')

Anthony

On Thursday, February 6, 2014 11:56:25 AM UTC-5, Mirek Zvolský wrote:
>
> Hi,
>
> >>>>>>>>>> I will see all form controls twice, in the 2nd case inside of 
> the target <span id='target'></span> where I wait the ajax() value. 
> <<<<<<<<<<<<<<<<<<<
>
> I work with Web2py 2.5.1 (I'm sorry).
> Can somebody make me sure, we have no longer following strange behavior in 
> newer versions?
> So if somebody can copy the controller and view provided bellow in the 
> current version and try call application/poptavka/poptavka/1 and then go 
> into textbox, fill something and move outside.
> If fixed already, any idea, how to patch 2.5.1?
>
> When I navigate to:
> controller/function
> all works well,
>
> but when I navigate to:
> controller/function/1
> >>>>>>>>>> I will see all form controls twice, in the 2nd case inside of 
> the target <span id='target'></span> where I wait the ajax() value. 
> <<<<<<<<<<<<<<<<<<<
>
> In other words: ajax() function will render and return the complete html 
> page layout - instead of simple string.
>
> My code:
> model - nothing - I have removed all completly and problem is still here
> controller poptavka.py
>   def poptavka():
>     form = SQLFORM.factory(
>             Field('fld', 'string'),
>             )
>     return dict(form=form)
> def echo():
>     return 'aaa'
> view poptavka/poptavka.html
>   {{extend 'layout.html'}}
>   {{=form}}
>   <span id="target"></span>
>   <script>
>   $(document).ready(function() {
>       $('#no_table_fld').change(function(){
>         ajax('echo', [], 'target');
>     });
>       });
>   </script>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to