Created
February 25, 2016 14:10
-
-
Save maxxscho/87b6bbba1f044c4796eb to your computer and use it in GitHub Desktop.
Get an url-parameter from the current URL
This file contains hidden or 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 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