Skip to content

Instantly share code, notes, and snippets.

@TRex22
Created January 6, 2015 14:23
Show Gist options
  • Save TRex22/c29df184ba6016ae1e31 to your computer and use it in GitHub Desktop.
Save TRex22/c29df184ba6016ae1e31 to your computer and use it in GitHub Desktop.
Code from StackOverflow to pull out url query strings in pure JavaScript
//http://stackoverflow.com/questions/11582512/how-to-get-url-parameters-with-javascript/11582513#11582513
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [,""])[1].replace(/\+/g, '%20')) || null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment