Skip to content

Instantly share code, notes, and snippets.

@kehr
Created October 15, 2015 07:10
Show Gist options
  • Save kehr/a8e054103f4ee289e108 to your computer and use it in GitHub Desktop.
Save kehr/a8e054103f4ee289e108 to your computer and use it in GitHub Desktop.
Get the search key of url
var getSearchKey = function(key){
if (!location.search) return null;
var list = location.search.split("?")[1].split("&");
for (var i=0; i < list.length; ++i){
if (!list[i]) continue;
var dict = list[i].split("=");
if (key == dict[0]){
return dict[1]
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment