On Wednesday, November 2, 2011 6:14:04 AM UTC-4, Vineet wrote:
>
> <script> 
> function populate(){ 
> var empid = "{{URL(('lod'))}}"; 
>

That's not how Ajax works -- you don't just assign a URL to a variable. 
Instead, you have to explicitly make an Ajax call. If the web2py ajax() 
function isn't suitable, you can use the jQuery .ajax() function 
(http://api.jquery.com/jQuery.ajax/). However, I think you can use the 
web2py ajax() function in this case, specifying the target as ":eval". That 
tells the function that the action will be returning some Javascript to be 
executed. So, do:

onclick="ajax({{=URL('lod')}}, ['i1'], ':eval');"

and have the lod action return:

"$('#i2').val('whatever');"

Anthony

Reply via email to