Last Updated: February 25, 2016
·
408
· arthur-alves

Very simple JS request all url vars

Very simple request all vars from url. Easy to understand.

function requestUrlVars(){ 
    var params = window.location.search
    if (params){
        var url_params = params.replace('?','').split('&');
        var requests = {};
        for(var i in url_params){
            var key = url_params[i].split('=');
            requests[key[0]] =  key[1];
        }
        return requests;    
    }else{
        return false;
    };
};