Last active
December 22, 2015 23:29
-
-
Save travhimself/6546838 to your computer and use it in GitHub Desktop.
js function to grab get paramaters from the URL
This file contains 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
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