Jquery / Javascript get params from window localtion
<p>My URL is:</p>

<pre><code>http://localhost:3000/?sort=rating
</code></pre>

<p>The parameter <code>sort</code> is dynamic, and I would like to add it to another URL.</p>

<p>In my javascript I have:</p>

<pre><code>window.location.pathname + '.js?page=' + currentPage
</code></pre>

<p>How do I add the <code>sort</code> parameter at the end? </p>

<p>Example:</p>

<pre><code>window.location.pathname + '.js?page=' + currentPage + &amp;sortparam
</code></pre>

<p>In this case it would be:</p>

<pre><code>window.location.pathname + '.js?page=' + currentPage + '&amp;sort=rating'
</code></pre>
