Get parameter values of an ajax request after form submit
I have a form_tag that looks like this:
<%= form_tag products_path, method:'get', remote: true, format: :js do %>
<%= number_field_tag :price, params[:price]%>
<%= submit_tag 'Go', class:'submit_button', :id => 'submit_button'%>
<% end %>
on the index action of the products_controller.rb, I have this:
def index
@price = params[:price]
....
end
The problem is that @price returns nil when i submit the form with remote:
true. I am able to get the value of @price when I remove remote: true and
submit the form without ajax. How can I get the parameters value(s) when i
submit the form via ajax ?
No comments:
Post a Comment