MIP.setData({ p:urlParams('p'), keywords:urlParams('keywords') }) function urlParams(paramName) { var reg = new RegExp("[\?&]" + paramName + "=([^&]*)[&]?", "i"); var paramVal = window.location.search.match(reg); return paramVal == null ? "" : decodeURIComponent(paramVal[1]); } getCounts(); function getCounts(){ fetch('/rest/share/queryCount') .then(data => { return data.json() }) .then(data => { MIP.setData({ total: data.total, SB2Count: data.SB2Count, JSCount: data.JSCount, mindMappingCount: data.mindMappingCount, }) }) .catch(e => { console.error(e); }) }