Created
April 21, 2021 10:52
-
-
Save igorshirinkin/2fd96cc07c85e9f6c41730558010b748 to your computer and use it in GitHub Desktop.
Get GET 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
var params = window.location.search.replace('?','').split('&').reduce( | |
function(param,delim) { | |
var split = delim.split('='); | |
param[decodeURIComponent(split[0])] = decodeURIComponent(split[1]); | |
return param; | |
},{} | |
); | |
console.log(params['data']); // 'data' - name of the required GET parameter. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment