I've seen this one asked regarding how to pass python array into javascript
array inside of a view, but here I want to do it inside a SCRIPT and it's
eluding me. I have a module.py that's generating a button with pulldown. I
want to be able to do something like this:
def mymodule():
T = current.T
x = [T('fee'),T('fie'),T('foe'),T('fum')] # I want to use the
translated values in the script below
return CAT(
DIV(... some stuff ...),
SCRIPT("""$(function() {
x = %(x)s;
... do something with x ...
""" % dict(x=x)
)
If also tried wrapping XML(json(x)) in the dict() part in the end. No dice.
Any thoughts how to do it gracefully?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.