Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript parse url parameters

let url = new URL("https://www.codegrepper.com?s=cool+beans&user_id=4");                                                  
let urlParams = new URLSearchParams(url.search); 
console.log(urlParams.get('s'));//cool beans
console.log(urlParams.get('user_id'));//4
 
PREVIOUS NEXT
Tagged: #javascript #parse #url #parameters
ADD COMMENT
Topic
Name
7+6 =