Skip to content

Instantly share code, notes, and snippets.

@micahblu
Created February 23, 2015 19:38
Show Gist options
  • Save micahblu/59b6b0e37aeb3da56c82 to your computer and use it in GitHub Desktop.
Save micahblu/59b6b0e37aeb3da56c82 to your computer and use it in GitHub Desktop.
collect url params as an array of key/value objects
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