Last active
November 21, 2018 15:31
-
-
Save debonx/a5a8c6754f1cc065e97b2bbabc8a1c7b to your computer and use it in GitHub Desktop.
JQuery / Javascript small function to get url parameters, for example https://your-link?param=value.
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
function get_url_param(name){ | |
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href); | |
if (results==null){ | |
return null; | |
} else { | |
if(results[1].indexOf("#")){ | |
results = results[1].split("#"); | |
results = results[0]; | |
} else { | |
results = results[1] || 0; | |
} | |
return results; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment