Skip to content

Instantly share code, notes, and snippets.

@jdcauley
Last active August 29, 2015 14:05
Show Gist options
  • Save jdcauley/9c9f1fd02515a399400b to your computer and use it in GitHub Desktop.
Save jdcauley/9c9f1fd02515a399400b to your computer and use it in GitHub Desktop.
getParams from URL and turn into object
function getParams(){
var params = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
params[hash[0]] = hash[1];
}
return params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment