Skip to content

Instantly share code, notes, and snippets.

@liujiangfeng
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liujiangfeng/997b77aaa4ab06238596 to your computer and use it in GitHub Desktop.
Save liujiangfeng/997b77aaa4ab06238596 to your computer and use it in GitHub Desktop.
queryString.js
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