Javascript get url parameters 2022

 Sometimes it is necessary to read get parameters on the page itself for subsequent processing.

 let searchParams = new URLSearchParams(window.location.search);
        let email = searchParams.get('email')
        if(email){
           $("#id_email").val(email);
        }

Does sent exist?

searchParams.has('email') // true
 
 

Comments