David,
We are trying to filter products based on check boxes. A criteria may have multiple check boxes and when each one of them is clicked, the data should further filter. This is similar to how Amazon does it too. We are preferring not to use the Submit button, as that makes the search less cleaner.
When we submit the form_to by using submit button it works. It also works with the links. However when we use the jquery to submit the form, the response is coming as a HTML string and rails is unable to render it.
Please find the code we used below for the same. Any guidance to help this work will be well appreciated.
<%= form_tag('/fetch_products', format: "js", remote: true, id: "states") do |f|%>
Shop By Region
<% states.each do |state| %>
<% end %>
```
shop by craft
<%= fields_for crafts do |cra| %>
<% crafts.each do |craft| %>
<% end %>
<% end %>
I'd probably do this in a different way. I'd bind a jQuery ajax call to a button then submit with jQuery. I don't have time to make the code for you right now but it shouldn't be too difficult.
David, We are trying to filter products based on check boxes. A criteria may have multiple check boxes and when each one of them is clicked, the data should further filter. This is similar to how Amazon does it too. We are preferring not to use the Submit button, as that makes the search less cleaner.
When we submit the form_to by using submit button it works. It also works with the links. However when we use the jquery to submit the form, the response is coming as a HTML string and rails is unable to render it.
Please find the code we used below for the same. Any guidance to help this work will be well appreciated.
<%= form_tag('/fetch_products', format: "js", remote: true, id: "states") do |f|%>
Shop By Region
shop by craft
I'd probably do this in a different way. I'd bind a jQuery ajax call to a button then submit with jQuery. I don't have time to make the code for you right now but it shouldn't be too difficult.