title: Check if url contains string with JQuery
body: <p>I have a page with select options and I am using JQuery to refresh the page and add a string to the url when an option is clicked.  Now I need a way to check the browsers url to see if it contains said string.</p>
  
  <p>Looking on other threads I thought <code>indexOf</code> would work, but when trying this it doesn't work.  How else would I check if the URL contains something like <code>?added-to-cart=555</code>? The complete URL would normally look like: <code>http://my-site.com</code>, and after clicking one of the options it looks like this after page reload: <code>http://my-site.com/?added-to-cart=555</code>.  I just need to check to see if the URL contains that <code>?added-to-cart=555</code> bit.</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>jQuery("#landing-select option").click(function(){
  
   $('#product-form').submit();
  
      window.location.href += $(this).val()
  
  });
  
  jQuery(document).ready(function($) {
  if(window.location.indexOf("?added-to-cart=555") &gt;= 0)
              {
                   alert("found it");
              }
  });
  </code></pre>