Passing parameters from Ruby to JS. Please Help


#1

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” %>

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.