Created
April 18, 2020 04:25
-
-
Save daimon99/9417c0cce9ff42267519a6cd7f025331 to your computer and use it in GitHub Desktop.
javascript获取url中的get参数 / javascript get the get param in the url.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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