rubyonrailsin

A Ruby and Rails talk

Saturday, March 20, 2010


[Rails] Accessing a Javascript variable in embedded Ruby

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Hi, I have a form that I am observing with observe_field

<%= observe_field :guess,
:frequency => 0.6,
:update => 'ajaxWrapper',
:url => {:action => 'feedback', :only_path => false},
:with => 'correct=#{@chapter[0])}'
%>

When I construct the parameters for the URL, I'd like to use a
javascript variable to index into the chapter array. (Instead of
always selecting the first element as in the example above)

Is that possible? I can't figure out how to access the variable from
within the #{}

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
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.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive