Skip to content

Instantly share code, notes, and snippets.

@muthuspark
Created January 31, 2017 06:08
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 muthuspark/6d30d7114c0a879802fe5a74579e2c65 to your computer and use it in GitHub Desktop.
Save muthuspark/6d30d7114c0a879802fe5a74579e2c65 to your computer and use it in GitHub Desktop.
if (window.location.search) {
var qs = window.location.search.split('+').join(' ');
var params = {},
tokens,
re = /[?&]?([^=]+)=([^&]*)/g;
while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
}
console.log(params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment