/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function get() { var get = new Object(); var parameters = window.location.toString().split("?").pop().split("&"); for (var i in parameters) { var parts = parameters[i].split("="); get[""+parts[0]+""] = parts[1]; } return get; } //http://www.example.com/?foo=bar&bar=foo var get = get(); console.log(get.foo) // returns "bar"