title: How to encode URL in JS and Decode in PHP?
body: <p>Following is my JS code:</p>
  
  <pre><code>window.location.href = 'products.php?price_range=-INFto2000,2001to5000';
  </code></pre>
  
  <p>My question is how do I encode the URL in javascript &amp; decode it in PHP, such that my browser's navigation bar will show </p>
  
  <blockquote>
    <p>"products.php?price_range=-INFto2000%2C2001to5000"</p>
  </blockquote>
  
  <p>instead of </p>
  
  <blockquote>
    <p>"products.php?price_range=-INFto2000,2001to5000"</p>
  </blockquote>
  
  <p>and my php code will be able to work with the proper value of <code>-INFto2000,2001to5000</code> in <code>$_GET['price_range']</code></p>