Showing posts with label url params. Show all posts
Showing posts with label url params. 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);