Ruby on Rails
Tuesday, November 25, 2014
Please notice that the <%= … %> expression for the partial is in an erb file and is evaluated on the server before it is sent to the user's browser. It is therefore not possible to have javascript variables be part of the expression. You need to rethink the partial and instead of using ruby variables it will have to use javascript variables.
Den söndagen den 23:e november 2014 kl. 14:38:39 UTC+1 skrev Ruby-Forum.com User:
-- Den söndagen den 23:e november 2014 kl. 14:38:39 UTC+1 skrev Ruby-Forum.com User:
My partial code:
view/clubs_registration/clubs/_dropzone_pictures.html.erb
<%= hidden_field_tag :club_id, name: :club_id, value: club_id %>
My initial view code:
view/clubs_registration/clubs/test_dropzone_pictures.html. erb
<%= render partial: 'dropzone_pictures', :locals => { :club_id =>
@club.id } %>
What I really want to do is retrieve the value of club_id from my
jquery:
console.log($("#club_id").val()); //-> {:name=>:club_id,
:value=>11500}
I just want the value 11500. How should I do that please?
--
Posted via http://www.ruby-forum.com/.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/38eb4589-4573-447d-96bd-32f57e1b7372%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment