Skip to content

Instantly share code, notes, and snippets.

@daimon99
Created April 18, 2020 04:25
Show Gist options
  • Save daimon99/9417c0cce9ff42267519a6cd7f025331 to your computer and use it in GitHub Desktop.
Save daimon99/9417c0cce9ff42267519a6cd7f025331 to your computer and use it in GitHub Desktop.
javascript获取url中的get参数 / javascript get the get param in the url.
function findGetParameter(parameterName) {
var result = null,
tmp = [];
location.search
.substr(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");
if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
});
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment