Last active
August 10, 2018 15:00
-
-
Save MeyCry/34a85d5fd03df5f8a63dbd0c46b2b418 to your computer and use it in GitHub Desktop.
get get param from url
This file contains hidden or 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 getUrlParameter(param) { | |
var pageUrl = decodeURIComponent(window.location.search.substring(1)), | |
urlVariables = pageUrl.split('&'), | |
parameterName, | |
i; | |
for (i = 0; i < urlVariables.length; i++) { | |
parameterName = urlVariables[i].split('='); | |
if (parameterName[0] === param) { | |
return parameterName[1] === undefined ? true : parameterName[1]; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment