Created
February 23, 2015 19:38
-
-
Save micahblu/59b6b0e37aeb3da56c82 to your computer and use it in GitHub Desktop.
collect url params as an array of key/value objects
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
function getURLParams () { | |
var params = []; | |
window.location.search.substring(1).split("&").every(function (pair){ | |
var obj = {}; | |
pair = pair.split("="); | |
obj[pair[0]] = pair[1]; | |
params.push(obj); | |
}); | |
return params; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment