Showing posts with label params from url. Show all posts
Showing posts with label params from url. Show all posts

Wednesday, November 16, 2016

jQuery get params from url

var params = {};
window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(str, key, value) {
    params[key] = decodeURIComponent(value.replace(/\+/g, ' '));
});
console.log(params);