Emmm.... I'm not sure you can do this in external js files.
URL(...) and "{{ ... }}" markup are python helpers defined in web2py, they
are only visible in python controller files and view files that will be
rendered by web2py framework. Static external js files are only plain js,
which wont be rendered by web2py. So the above "{{=URL(...)...}}" is only a
plain string to javascript.
However, ajax() is a javascript function defined by web2py.js, so it's
visible in js files. So just use the direct url instead of the markup. The
following code in static js files should do what you want:
ajax("control2/function1", ['name'],'target')
ps: I realized this is an old thread, but the comment may help future users
who google for similar problems.
Post by PradeeshI am new to web2py.
form my view i am able to call web2py ajax as "
ajax("{{=URL(r=request,c='control2',f='function1')}}"['name'],'target');
". But the same command is not working from an external javascript.
How can i call a function (in another control file) using ajax from an
external JavaScript.
--
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.