Last active
December 17, 2015 00:19
-
-
Save achudars/5520455 to your computer and use it in GitHub Desktop.
Getting all URL parameters using JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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