How to Pass Jquery selected dropdown values and radio button values to controller

Hi,

I have an advance search page and its code is as follows -

I have written my code like this <div class="container">   <%= form_tag search_index_path, method: :get do %>     <%= radio_button_tag 'user_type', 'customer' %><p>Customer</p>     <%= radio_button_tag 'user_type', 'supplier' %><p>Supplier</p>   <% end %>     <h2>Search Criteria</h2>   <div id="dropdown">     <p>State</p>     <%= collection_select(:customer, :customer_number, Customer.all, :id, :state) %>     <p>City</p>     <%= collection_select(:customer, :customer_number, Customer.all, :id, :city) %>     <p>Name</p>     <%= collection_select(:customer, :customer_number, Customer.all, :id, :name) %>   </div>   <div id="dropdown1">     <p>State</p>     <%= collection_select(:supplier, :supplier_number, Supplier.all, :id, :state) %>     <p>City</p>     <%= collection_select(:supplier, :supplier_number, Supplier.all, :id, :city) %>     <p>Name</p>     <%= collection_select(:supplier, :supplier_number, Supplier.all, :id, :name) %>   </div> </div>

<%= submit_tag "Search", name: nil %> <script>     $(document).ready(function() {         $("#dropdown").hide();         $("#dropdown1").hide();         $("input[type='radio'][name='user_type'][value='customer']").click(function(){           $("#dropdown1").hide();           $("#dropdown").show();         $("input[type='radio'][name='user_type'][value='supplier']").click(function(){           $("#dropdown").hide();           $("#dropdown1").show();

          });         });     }); </script>

I have two models and controllers for customer and supplier respectively. Now after selecting the values on search page when user click on search how to pass these values to controller so that it will return search results from model.

Hi,

Maybe you can check those

http://railscasts.com/episodes/88-dynamic-select-menus http://railscasts.com/episodes/111-advanced-search-form