How can i pass multiple values of fropdowns in url?

How can i pass multiple values of fropdowns in url?

Hey guys, 
I'm currently creating a project with Codeigniter and i have some dropdowns which will filter my db results using "GET" method in url.

What i want is to pass or replace (if its already in the url) the value of the selected dropdowns ONLY, like an array.

A guy helped me on some point but on selecting another dropdown box the value in url is replaced with the last chosen. Could you please help me on that?!

P.S.: If you faced the same (filtering results) and you have a different proposal on how to achieve this, please do it freely!!

Thank you!!

MyJquery code:
  1.   $('#filters select').change(function(){
  2.       let filters = [];
  3.       $('#filters select').each(function(){
  4.           const string = $(this).attr('id');
  5.           const value = $(this).val();
  6.           if(value != '') {
  7.             filters.push(string + '=' + value);
  8.           }
  9.       });
  10.       window.location.search = filters.join('&');
  11.   });



My html dropdowns code: 
  1. <div class="col-lg-2" id="filters">
  2. <div class="form-group mt-3">
  3.           <select class="form-control filter-selection" id="petStatus">
  4.             <option value="">-- Status --</option>
  5.             <option value="1">Lost</option>
  6.             <option value="2">Found</option>
  7.           </select>
  8.         </div>

  9.         <div class="form-group input-group">
  10.           <select class="form-control filter-selection" id="petType">
  11.             <option value="">-- Choose type --</option>
  12.             <option value="1">Cat</option>
  13.             <option value="2">Dog</option>
  14.             <option value="3">Other</option>
  15.           </select>
  16.         </div>
  17. </div>