Created
December 14, 2018 03:59
-
-
Save igorvolnyi/5fda514fa4b4668f1377e16c4923e507 to your computer and use it in GitHub Desktop.
Get GET parameters in your browser as JS object.
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 getGetParameters() { | |
var s1 = location.search.substring(1, location.search.length).split('&'), | |
r = {}, s2, i; | |
for (i = 0; i < s1.length; i += 1) { | |
s2 = s1[i].split('='); | |
r[decodeURIComponent(s2[0])] = decodeURIComponent(s2[1]); | |
} | |
return r; | |
} | |
window.ServerData = getGetParameters(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment