How to get URL parameters in JavaScript

2 Answers

0 votes
 const URL = new URLSearchParams("http://seek4info.com/search.php?q=hosting&total=10&size=25k");
 
console.log(URL.getAll('total'));
console.log(URL.getAll('size'));
 
 
   
     
/*
run:
     
["10"]
["25k"]
     
*/

 



answered Jan 31, 2021 by avibootz
edited Jan 31, 2021 by avibootz
0 votes
const URL = new URLSearchParams("http://seek4info.com/search.php?q=hosting&total=10&size=25k");
  
console.log(URL.get('total'));
console.log(URL.get('size'));
  
  
    
      
/*
run:
      
"10"
"25k"
      
*/

 



answered Jan 31, 2021 by avibootz

Related questions

...