Created
June 25, 2015 16:07
-
-
Save supersloth/317975aa314a3e5506aa to your computer and use it in GitHub Desktop.
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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> | |
<script language="JavaScript" type="text/javascript"> | |
function getUrlValue(varSearch) { | |
var searchString = window.location.search.substring(1); | |
var variableArray = searchString.split('&'); | |
for (var i = 0; i < variableArray.length; i++) { | |
var keyValuePair = variableArray[i].split('='); | |
if (keyValuePair[0] == varSearch) { | |
return keyValuePair[1]; | |
} | |
} | |
} | |
$(document).ready(function(){ | |
var v = getUrlValue('lang'); | |
console.log(v); | |
}) | |
</script> | |
//access with url_javascript.html?lang=english |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment