Extract values from href attribute string using JQuery
<p>I would like to extract values from href attribute string using JQuery</p>

<pre><code>$(this).attr("href")
</code></pre>

<p>will give me</p>

<pre><code>?sortdir=ASC&amp;sort=Vendor_Name
</code></pre>

<p>What i need is these values parsed into an array</p>

<pre><code>myArray['sort']

myArray['sortdir']
</code></pre>

<p>Any ideas?
Thanks!</p>

<p>BTW , I saw somewhere else on SO the following similar idea to be used with a query string.
I could not tweak it for my needs just yet.</p>

<pre><code>var urlParams = {};
    (function () {
        var match,
    pl = /\+/g,  // Regex for replacing addition symbol with a space
    search = /([^&amp;=]+)=?([^&amp;]*)/g,
    decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
    query = window.location.search.substring(1);

        while (match = search.exec(query))
            urlParams[decode(match[1])] = decode(match[2]);
    })();
</code></pre>
