Skip to content

Instantly share code, notes, and snippets.

@hahwul
Created December 30, 2020 02:30
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 hahwul/36ec51195675b73e60b8adb054657c80 to your computer and use it in GitHub Desktop.
Save hahwul/36ec51195675b73e60b8adb054657c80 to your computer and use it in GitHub Desktop.
Get vaule of parameter from URL
function getParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
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