Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js append url params

var url = new URL('http://demourl.com/path?topic=main');
var search_params = url.searchParams;

search_params.append('id', '101');
search_params.append('id', '102');

url.search = search_params.toString();

var new_url = url.toString();

// output : http://demourl.com/path?id=100&id=101&id=102&topic=main
console.log(new_url);
Source by usefulangle.com #
 
PREVIOUS NEXT
Tagged: #js #append #url #params
ADD COMMENT
Topic
Name
7+3 =