Thursday, October 13, 2011

Re: [Rails] How to access controller's instance variable in a js.erb loaded by javascript_include_tag?

And what if it is a large array of values?...
Ok to pass them as a contents of the tag?
I know I could do it with ajax request, but how do I pass this large amount of data when JS is disabled...
What I'm doing is feeding data to jQuery Flot library.
And it accepts data in place of a plot initialization, e.g.

$.plot("#placeholder", data)

so I need to somehow inline this data when initializing element => js.erb.
And then I expect to have something like:

$.plot("#placeholder", <%= @user.generate_flot_data %>)

I'm a bit new to this stuff, may ask stupid questions :)

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/X-id2vt_TEMJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate