On Tuesday, November 8, 2011 7:45:59 AM UTC-5, Vineet wrote:
>
> In a View, there is -->   ajax('{{=URL("salhead_edit")}}, [], 
> ':eval');
>

Probably a typo, but missing the closing single quote (') after the }} for 
the URL.
 

> "salhead_edit" returns js function -->  'abc(myvar1)'
>

Unless 'myvar1' is a variable already defined in javascript somewhere in 
your page, that won't work. If 'myvar' is a Python variable, you're going 
to have to insert its actual value (in quotes if it is a string) into the 
JS code. Remember, from web2py's perspective in the controller, the JS code 
you're building is simply a string -- it doesn't know it is code. Something 
like:

myvar1 = 'whatever'
js = 'abc("%s");' % myvar1

will return:

abc("whatever");

Note, it's a good idea to add the ";" at the end of the line.

Anthony

Reply via email to