Chartjs-Pass variable from function js to other function js

0👍

Rather than rebuilding the URL from scratch, you could take the page’s current URL and only modify the parameter that was updated in the dropdown.

function changestore(){
      var filterstoregen = document.getElementById("filterstoregen").value;
      let params = (new URL(window.location)).searchParams;
      params.set('storename', filterstoregen);
      window.location.search = params.toString();
 }


function changeday(){
      var filterday = document.getElementById("filterday").value;
      let params = (new URL(window.location)).searchParams;
      params.set('dayname', filterday);
      window.location.search = params.toString();
 }

Leave a comment