Skip to content

Instantly share code, notes, and snippets.

@codeyourwayup
Created April 20, 2020 02:40
Show Gist options
  • Save codeyourwayup/d5da0215a13e6b29f077a0d57052e90a to your computer and use it in GitHub Desktop.
Save codeyourwayup/d5da0215a13e6b29f077a0d57052e90a to your computer and use it in GitHub Desktop.
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment