In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example:
Original URL:
This will work in all modern browsers.
function insertParam(key,value) { if (history.pushState) { var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' +key+'='+value; window.history.pushState({path:newurl},'',newurl); } }