I am using jQuery to assign a value to a hidden field:
$('#hidden_id').val("ABC");
In my View, I have:
<%= hidden_field_tag(:id => "hidden_id", :val => "") %>
How do I pass the value "ABC" from the form to to my Controller (through the param ":val")?
You should be defining your hidden_field_tag like this
<%= hidden_field_tag 'hidden', '', id: 'hidden_id' %>
equivalent to
<input type="hidden" name="hidden" id="hidden_id" value="">
take a look at the documentation for help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.