url update javascript code example
Example 1: js update query string
var searchParams = new URLSearchParams(window.location.search);
searchParams.set("foo", "bar");
window.location.search = searchParams.toString();
Example 2: javascript change url without reload
window.history.pushState('', 'New Page Title', '/new-url.php');