Skip to content

Instantly share code, notes, and snippets.

@bjrnqprs
Created November 15, 2013 10:12
Show Gist options
  • Select an option

  • Save bjrnqprs/7482094 to your computer and use it in GitHub Desktop.

Select an option

Save bjrnqprs/7482094 to your computer and use it in GitHub Desktop.
Return the given GET parameter, or null if not found.
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