title: pass three dropdown selected values as a parameters via Ajax to controller
body: <p>in jquery three dropdownlists values passing as  parameters via ajax  in button click event<br>
  but the value we store dropdownvalue cant we use out of the change function?  </p>
  
  <pre><code> $("#rooms").change(function () {
          var searchRooms = $("#rooms").val();       
   });
  </code></pre>
  
  <p>like this i need three varaibles(dropdownvalues) in button click event<br>
  i have three dropdownlists in view. i have selected one value from one dropdownlist using above code. now i need to select three values from three different dropdown lists.so if i use the above code to select one value from one dropdown then that value will be stored in searchRooms varaible.now i need to use(pass) the varaible to controller.if i close the change function i cant use the varaible value. am i correct? so i need to pass three dropdown list values to controller that to in button click event </p>
  
  <blockquote>
    <p>another issue,declaring as global variable.</p>
  </blockquote>
  
  <pre><code>  $(#"btn").click(function(){
      var searchRooms;
      var searchAdults;
      var searchChildren;
       $("#rooms").change(function () {
          searchRooms = $("#rooms").val();
      });
  
      $("#adults").change(function () {
          searchAdults = $("#adults").val();
      });
  
      $("#searchChildren").change(function () {
          searchChildren = $("#children").val();
      });
  
     $.ajax({
     i need pass the above three variable values to controller here
    });
    });
  </code></pre>
  
  <blockquote>
    <p>in this after change function what will be the value of variable searchRooms?<br>
    in alert i am getting the value is undefined means,there is no value for searchRooms?<br>
    how can i pass that variable to controller?  </p>
  </blockquote>