javascript change get parameter without reload
function replaceQueryParam(param,newval,search){ var regex=new RegExp("([?;&])"+param+"[^&;]*[;&]?"); var query=search.replace(regex,"$1").replace(/&$/,''); return (query.length>2?query+"&":"?")+(newval?param+"="+newval:''); } var next_page=2; var search_param=location.search; search_param=replaceQueryParam('page',next_page,search_param); var newurl=window.location.pathname+search_param; window.history.pushState({path:newurl},'',newurl);