Skip to content

Instantly share code, notes, and snippets.

@TravelingTechGuy
Created June 10, 2014 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TravelingTechGuy/31c56cc2550d8c711ec0 to your computer and use it in GitHub Desktop.
Save TravelingTechGuy/31c56cc2550d8c711ec0 to your computer and use it in GitHub Desktop.
Get value from a key in a query string
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