I have an instance variable @foo in my create controller action and I am rendering create.rjs template. In the RJS template I need to call a js function (with page.call) and pass @foo as params. How is it possible..
Check out the gem gon . I am using it to pass rails variables to my javascript code.
我使用RJS已经好几年了,但这可能有用:
page.call "your_function(#{ escape_javascript(@some_instance_var) })"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.