title: Split and parse window.location.hash
body: <p>I'm facing issues with splitting and parsing window.location.hash correctly.</p>
  
  <p>First of all, we get few parameters in hash, ex:</p>
  
  <pre><code>#loc=austria&amp;mr=1&amp;min=10&amp;max=89
  </code></pre>
  
  <p>As you surely see it's been created for search. When user clicks on pagination link page is being reloaded with the hash. So far so good.</p>
  
  <p>I created function initialise() that is calling every time when there's hash in the URL:</p>
  
  <pre><code>if (window.location.hash) {
      var params = (window.location.hash.substr(1)).split("&amp;");
  
      for (i = 0; i &lt; params.length; i++)
      {
          var a = params[i].split("=");
          // Now every parameter from the hash is beind handled this way
          if (a[0] == "loc")
          {
              locationList(a[1]);
          }
      }
  }
  </code></pre>
  
  <p>Everythig is almost working... When I choose all search params hash is being... cut. For unknown reason for me. I tried to use <code>if( params.indexOf('loc') )</code> instead of <code>a[0] == "loc"</code> without any luck.</p>
  
  <p>Could you lend me a hand?</p>
  
  <p><strong>Edit</strong><br>
  Of course, I was using var a = ... in the loop, it was only copy-paste error.</p>