Skip to content

Instantly share code, notes, and snippets.

@digitalicarus
Last active December 10, 2015 22:38
Show Gist options
  • Save digitalicarus/4503577 to your computer and use it in GitHub Desktop.
Save digitalicarus/4503577 to your computer and use it in GitHub Desktop.
function parseQueryString(altStr) {
var s = altStr || window.location.search.substring(1)
, p = s.split("&")
, t = []
, q = {}
, i = 0
;
for(i = 0; i < p.length; i++) {
t = p[i].split("=");
q[decodeURIComponent(t[0])] = (t[1]) ? decodeURIComponent(t[1]) : null;
}
return q;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment