Search code examples
ruby-on-rails-3link-tolink-to-remote

Rails 3 - How to send data on link_to :remote=>true?


I am trying to figure out the new link_to in Rails 3 but i still don't get it In Rails 2 I do:

<%= link_to_remote "My Link",:url=>{:action=>:myaction},:with=>"'data='+$('#someField').attr('value')" %>

but with the new syntax in Rails 3 how should it be?

I'm trying something like

<%=link_to "My Link",{:action=>"myaction"},:with=>"'data='+$('#someField').attr('value');",:remote=>true%>

but I'm not getting the quantity params in the controller's action


Solution

  • They say its no longer supported in this answer on How to send Javascript Variable to a controller's action with the link_to helper?