Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get an url-parameter from the current URL
var getUrlParameter = function(param) {
var pageUrl = window.location.search.substring(1);
var urlVariables = pageUrl.split('&');
for (var i = 0; i < urlVariables.length; i++) {
var parameterName = urlVariables[i].split('=');
if (parameterName[0] == param) {
return parameterName[1];
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.