/ Published in: JavaScript

url: http://www.example.com/?foo=bar
usage: $_GET['foo'] // 'bar'
usage: $_GET['foo'] // 'bar'
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var $_GET = {}; document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () { function decode(s) { return decodeURIComponent(s.split("+").join(" ")); } $_GET[decode(arguments[1])] = decode(arguments[2]); });
Comments
