title: how to set ajax data $key and $value using variables
body: <p>I'm trying to dynamically create ajax data $key and $value for a search query. I have three dropdown menus and when one changes i'd want to loop trough each of them to get their values and create a $key + $value for my ajax data. </p>
  
  <p>So far i've got:</p>
  
  <pre><code>$(document).on("change", ('select'), function(e){ 
  
      $('select').each(function(i, val){
          value = $(this).val();
          param_name = $(this).attr("name");
          var query = { };
          query['' + param_name + ''] = value;
          console.log(query);
      });
  
      search(query);
  }); 
  </code></pre>
  
  <p>But this of course creates 3 different query's instead of one combined.</p>
  
  <p>Or is there a way to simply add/update a search query once a filter is changed instead of looping through each one of them every time. </p>