Created
April 27, 2016 18:15
-
-
Save chancesmith/db6a5112097de1dd503ba562afbdae41 to your computer and use it in GitHub Desktop.
Get variable from URL - javascript
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 getUrlVar(q) { | |
return (window.location.search.match(new RegExp('[?&]' + q + '=([^&]+)')) || [, null])[1]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment