Forum: Ruby on Rails Passing parameters from Ruby to JS. Please Help.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Anton Kalachev (Guest)
on 2007-06-18 10:19
(Received via mailing list)
Hi,

I am using Ext Grid to draw a table.

show.rhtml page allows to access account data so the url look like
http://<server_name>/<project_name>/show/1, where 1 is an account id.

show.rhtml has the following code:

<%= javascript_include_tag "grid.js" %>
<div id="grid" style="border:5px solid #99bbe8; overflow:hidden; width:
650px;"></div>

grid.js is used for grid initialization and rendering it accesses the
"<project_name>/grid_data" method that is in the project controller

grid_data forms the jsondata for the grid.

The problem: grid.js has no idea for what account the grid is
rendered. However, account id is required in grid_data to provide a
proper json data. How do I pass account id from "show.rhtml" to
"grid.js"?

Thanks for your help.
This topic is locked and can not be replied to.