query-params.js 300 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
// http://james.padolsey.com/javascript/bujs-1-getparameterbyname/
function getParameterByName(name) {
    var match = RegExp('[?&]' + name + '=([^&]*)')
                    .exec(window.location.search);

    return match ?
        decodeURIComponent(match[1].replace(/\+/g, ' '))
        : null;
}