Created
June 10, 2014 18:39
-
-
Save TravelingTechGuy/31c56cc2550d8c711ec0 to your computer and use it in GitHub Desktop.
Get value from a key in a query string
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
var getValueFromQueryString = function(url, key) { | |
return decodeURIComponent(new RegExp('[?|&]' + key + '=' + '([^&;]+?)(&|#|;|$)').exec(url) || [,""])[1].replace(/\+/g, '%20') || null; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment