Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save achudars/5520455 to your computer and use it in GitHub Desktop.
Save achudars/5520455 to your computer and use it in GitHub Desktop.
Getting all URL parameters using JavaScript
// this object gets filled with params
var params = {};
// split and map parameters
location.search.substr(1).split('&').forEach(function(p) {
p = p.split('=');
params[p[0]] = decodeURIComponent(p[1] || 1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment