I am trying a custom AJAX like functionality.
I know, AJAX function in web2py is there.
But i need to populate values of html elements by their IDs.
Not just show the result in a 'target' DIV.
----simplified code follows----
[Controller]
def lod():
do some processing on "request.vars.i1"
and calculate "emp_id"
return emp_id
[/Controller]
[View]
{{extend 'layout.html'}}
<input type='text' value='type a value' id='i1' name='i1' />
<a href='#' onclick='populate()'>Load result via AJAX </a>
<br /><br />
<input type='text' id='i2' name='i2' value='result here' />
<script>
function populate(){
var empid = "{{URL(('lod'))}}";
window.alert(empid);
$('#i2').val(empid);
}
</script>
[/View]
Any suggestion on the same?
Thanks,
Vineet