Created
December 30, 2020 02:30
-
-
Save hahwul/36ec51195675b73e60b8adb054657c80 to your computer and use it in GitHub Desktop.
Get vaule of parameter from URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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