Skip to content

Instantly share code, notes, and snippets.

@vic797
Created May 28, 2019 04:28
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 vic797/b332b1d282d2cefcdce11a7b11adf124 to your computer and use it in GitHub Desktop.
Save vic797/b332b1d282d2cefcdce11a7b11adf124 to your computer and use it in GitHub Desktop.
Function to read the GET parameters from JavaScript
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