Skip to content

Instantly share code, notes, and snippets.

@atesgoral
Created July 8, 2009 19:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save atesgoral/143101 to your computer and use it in GitHub Desktop.
Save atesgoral/143101 to your computer and use it in GitHub Desktop.
function getQueryParams(qs) {
qs = qs.replace(/\+/g, " ");
var params = {},
re = /[?&]?([^=]+)=([^&]*)/g,
tokens;
while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
}
return params;
}
//var query = getQueryParams(document.location.search);
//alert(query.foo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment