jquery change url parameter code example
Example: update param in url jquery
var url = new URL('http://demourl.com/path?id=100');
var search_params = url.searchParams;
// add "topic" parameter
search_params.set('topic', 'main');
url.search = search_params.toString();
var new_url = url.toString();
// output : http://demourl.com/path?id=100&topic=main
console.log(new_url);