Created
May 28, 2019 04:28
-
-
Save vic797/b332b1d282d2cefcdce11a7b11adf124 to your computer and use it in GitHub Desktop.
Function to read the GET parameters from JavaScript
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 loadGet() { | |
var getData = {}; | |
var url = decodeURI(window.location.href); | |
try { | |
var getArr = url.split("?")[1]; | |
var args = getArr.split("&"); | |
for (var a = 0; a < args.length; a++) { | |
var kv = args[a].split("="); | |
getData[kv[0]] = kv[1]; | |
} | |
} catch (error) { } | |
return getData; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment