I suggest using jquery.post
jQuery.post('{{=URL('testfunction')}}',{'key':'value'})
{'key':'value'} is a js dictionary, can be anything you like and tehy will
be passed as vars properly escaped.
On Friday, 11 January 2013 04:22:23 UTC-6, yn yn wrote:
>
> Hi, How to send a string from a javascript function to a controller
> function using ajax?
> Using ajax('{{=URL('testfunction/1')}}',[''],''); in the view, I can send
> the argument 1 to the testfunction in the default.py.
> But if I have a string str in a javascript function in the view who can
> change, I can' t put it in the place of 1 argument.... So how can I do
> this?
> is ajax the best way? any exemple? how to get the data in the controller
> function? using request.args(0)?
> thanks for you help
>
--