title: How to get a specific portion of the url using javascript?
body: <pre><code>var url = window.location.href.toString();
  </code></pre>
  
  <p>the above line gives me the url of my current page correctly and my url is:</p>
  
  <pre><code>http://localhost/xyzCart/products.php?cat_id=35
  </code></pre>
  
  <p>However, using javascript how can i get only a portion of the url i.e. from the above url i just want </p>
  
  <pre><code>products.php?cat_id=35
  </code></pre>
  
  <p>How to accomplish this plz help.I have looked at similar questions in this forum but none were any help for me..</p>