Skip to content

Instantly share code, notes, and snippets.

@maxxscho
Created February 25, 2016 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxxscho/87b6bbba1f044c4796eb to your computer and use it in GitHub Desktop.
Save maxxscho/87b6bbba1f044c4796eb to your computer and use it in GitHub Desktop.
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