我在控制器中有这个
...
..
render :js => "window.location = '/bar/ready'", :locals => { :foo => "foo" }
..
...
我想要<% foo %>
变量,我想在我的HTML页面中访问它。
但我似乎无法访问它,因为<%= params.inspect %>
返回
{"controller"=>"bar", "action"=>"ready"}
那么如何在HTML页面中传递变量呢?
答案 0 :(得分:0)
我需要类似的东西。迟到了,但我终于设法做到了:
render :js => "window.location = #{your_path(:foo => 'foo').to_json}"
然后在视图中解析json数据