Just as an example
teste.py
def sum():
return int(request.args(0)) + int(request.args(1))
any view:
<script>
$(document).ready(function(){
$('#button').click(function(){
ajax("{{=URL(r=request,
c='teste',f='sum.load',args=[1,2])}}",[],'target');
return false;
});
});
</script>
<a id="button">CLICK HERE</a>
<span id='target'></span>
RETURNS 3
With input fields:
teste.py
def sum():
return request.vars.name*10
view
<script>
$(document).ready(function(){
$('#button').click(function(){
ajax("{{=URL(r=request, c='teste',f='sum.load')}}",['name'],'target');
return false;
});
});
</script>
<form>
<input name='name' id='name' />
</form>
<a id="button">CLICK HERE</a>
<span id='target'></span>
RETURNS name*10
2010/7/27 ilovesss2004 <[email protected]>
> Hi,
>
> Can some one tell me how to call a function which is in another
> controller other than default controller by ajax?
>
> Thanks alot.
--
http://rochacbruno.com.br