Skip to content

Instantly share code, notes, and snippets.

@tanftw
Last active August 29, 2015 14:15
Show Gist options
  • Save tanftw/fbd4b50b17f991f786c7 to your computer and use it in GitHub Desktop.
Save tanftw/fbd4b50b17f991f786c7 to your computer and use it in GitHub Desktop.
PHP $_GET for Javascript
var parts = window.location.search.substr(1).split("&");
var $_GET = {};
for (var i = 0; i < parts.length; i++) {
var temp = parts[i].split("=");
$_GET[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment