Created
February 24, 2016 21:20
-
-
Save xlbruce/be3f2e924a4300a2f6b4 to your computer and use it in GitHub Desktop.
Gets a param in a query string (JavaScript)
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
function get(name){ | |
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search)) | |
return decodeURIComponent(name[1]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment