Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript urlsearchparams to string

let params = new URLSearchParams('foo=2'); // "location.search" to read from URL

params.append('bar', 4);                   //Add a bar parameter.
console.log(params.toString());            //Prints 'foo=2&bar=4'

location.search = params.toString();       // write changes to URL
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #urlsearchparams #string
ADD COMMENT
Topic
Name
3+7 =