let url = window.location.search; let params = {};
url.substr(1).split('&').forEach(function(item) { let pair = item.split('='); params[pair[0]] = decodeURIComponent(pair[1] || ''); });
let name = params['name']; let age = params['age'];
console.log(name); console.log(age);
|