Skip to content

Instantly share code, notes, and snippets.

@fernanDOTdo
Created December 22, 2017 16:44
Show Gist options
  • Select an option

  • Save fernanDOTdo/c913a61e99d157132c64f6d263958aad to your computer and use it in GitHub Desktop.

Select an option

Save fernanDOTdo/c913a61e99d157132c64f6d263958aad to your computer and use it in GitHub Desktop.
Easy way to get Query String Values
var qs = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=', 2);
if (p.length == 1)
b[p[0]] = "";
else
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
}
return b;
})(window.location.search.substr(1).split('&'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment