Skip to content

Instantly share code, notes, and snippets.

@actongorton
Created October 22, 2014 00:07
Show Gist options
  • Save actongorton/a561fda334949f9582b2 to your computer and use it in GitHub Desktop.
Save actongorton/a561fda334949f9582b2 to your computer and use it in GitHub Desktop.
Get GET and POST values from URL
// get query arguments
var test
var $_GET = {},
args = location.search.substr(1).split(/&/);
for (var i=0; i<args.length; ++i) {
var tmp = args[i].split(/=/);
if (tmp[0] != "") {
test = $_GET[decodeURIComponent(tmp[0])] = decodeURIComponent(tmp.slice(1).join("").replace("+", " "));
}
}
console.log(test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment