Skip to content

Instantly share code, notes, and snippets.

@damirm
Created April 28, 2015 14:46
Show Gist options
  • Save damirm/3df0e90e125a2d884ca0 to your computer and use it in GitHub Desktop.
Save damirm/3df0e90e125a2d884ca0 to your computer and use it in GitHub Desktop.
$_GET
var $_GET = (function () {
var getParams;
return function (param) {
if ( ! getParams ) {
getParams = decodeURIComponent(window.location.search.slice(1))
.split('&')
.reduce(function _reduce (a, b) {
b = b.split('=');
a[b[0]] = b[1];
return a;
}, {});
}
return getParams[param];
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment