Skip to content

Instantly share code, notes, and snippets.

@hrkd
Last active December 17, 2015 09:58
Show Gist options
  • Select an option

  • Save hrkd/5590734 to your computer and use it in GitHub Desktop.

Select an option

Save hrkd/5590734 to your computer and use it in GitHub Desktop.
GETパラメータ取得
location.__proto__.getParm = (function(){
if(this.search){
var query = [];
var tmpQ = [];
query = location.search.replace("?","").split("&");
for(var i=0;i<query.length;i++){
tmpQ[query[i].split("=")[0]] = query[i].split("=")[1];
}
return tmpQ ? tmpQ : undefined;
}else{
return undefined;
}
})();
//location.getParm["foo"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment