Take a controller called math.py
def sum():
return 1+2 #returns 3
In any view
<script>
$(document).ready(function(){
$('#button').click(function(){
ajax("{{=URL(r=request, c='math',f='sum.load')}}",'','target');
return false;
});
});
</script>
<a id="button">CLICK HERE</a>
<span id='target'></span>
The last tip, could be writen as:
{{=LOAD(url=URL(r=request,c='math',f='sum.load'), ajax=True)}}
2010/7/27 ilovesss2004 <[email protected]>
> How to write it in javascript? e.g.
> onclick=URL(request.application,'controllerName','FunctionName.load'),
> ajax=True)?
>
> On Jul 27, 10:35 pm, Bruno Rocha <[email protected]> wrote:
> > In a view:
> >
> >
> {{=LOAD(url=URL(request.application,'controllerName','FunctionName.load'),
> > ajax=True)}}
> >
> > 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
>
--
http://rochacbruno.com.br