title: Handle multiple data/parameters that change in Ajax - Wordpress
body: <p>i am trying to filter custom post type called podcasts with ajax, using two custom taxonomies id as parameters, genre and country.</p>
  
  <p>This is the front end: <a href="https://imgur.com/a/G2vB62q" rel="nofollow noreferrer">https://imgur.com/a/G2vB62q</a>.</p>
  
  <p>As you can see, i can choose a genre or/and a country to use as filter for my posts (below there is an array with the parameters that are passed).</p>
  
  <p>In my podcast page i have two foreach, with link within, with name and the term_id.</p>
  
  <pre><code>foreach ($genre/$country as $category) {
      echo '&lt;a class="button-prova/button-prova2 premuto2"
      name="keyword/keyword2" id="keyword/keyword2" 
       value="'.$category-&gt;term_id.'" 
       href="#"&gt;'.$category-&gt;name.'&lt;/a&gt;';   
  } 
  </code></pre>
  
  <p>Then, within function.php, i have my ajax function and ajax-fetch.</p>
  
  <pre><code>$( document ).ready(function() {
      $(document).on("click touchend", ".premuto, .premuto2", function () {
      fetch(this);
      });
  });
  function fetch(prova){
      if($(prova).attr('name') == 'keyword'){
          var1 = $(prova).attr('value') ? jQuery(prova).attr('value') : 0;
      } else
            {
               var2 = $(prova).attr('value') ? jQuery(prova).attr('value') : 0;
            }
      jQuery.ajax({
          url: '&lt;?php echo admin_url('admin-ajax.php'); ?&gt;',
          type: 'post',
          data: { action: 'data_fetch', keyword: [var1,var2] },
          success: function(data) {
              jQuery('#datafetch').html( data );
          }
      });
  }
  </code></pre>
  
  <p>At first, when i choose one genre, the country is set to 0, as you see in the code. But when i select the other taxonomy, genre set to 0 (or vice versa, like in the image). There is a way to store my precendent selection? </p>