Skip to content

Instantly share code, notes, and snippets.

@MeyCry
Last active August 10, 2018 15:00
Show Gist options
  • Save MeyCry/34a85d5fd03df5f8a63dbd0c46b2b418 to your computer and use it in GitHub Desktop.
Save MeyCry/34a85d5fd03df5f8a63dbd0c46b2b418 to your computer and use it in GitHub Desktop.
get get param from url
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