Created
April 26, 2015 04:54
-
-
Save yantze/40791f5ba1512051d7e9 to your computer and use it in GitHub Desktop.
get URL parameter
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
// get URL parameter | |
function get_param(name) | |
{ | |
if (location.href.indexOf("?") >= 0) { | |
var query=location.href.split("?")[1]; | |
var params=query.split("&"); | |
for (var i = 0; i < params.length; i ++) { | |
value_pair=params[i].split("="); | |
if (value_pair[0] == name) | |
return unescape(value_pair[1]); | |
} | |
} | |
return ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment