Skip to content

Instantly share code, notes, and snippets.

@travhimself
Last active December 22, 2015 23:29
Show Gist options
  • Save travhimself/6546838 to your computer and use it in GitHub Desktop.
Save travhimself/6546838 to your computer and use it in GitHub Desktop.
js function to grab get paramaters from the URL
var getparams = function(param) {
var url = window.location.search.substring(1);
var urlvars = url.split('&');
for (var i = 0; i < urlvars.length; i++) {
var paramname = urlvars[i].split('=');
if ( paramname[0] == param) {
return paramname[1];
}
}
};
var param1 = getparams('param1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment