How to get and put string into link

Hi all,
I’m the beginner of Wix.
How to get a string value from a hyperlink that point to my wix page?
And then I would like to use that “get” string to add into a hyperlink in my page.
How can I do it in Wix?

eg. if the link to my wix site is Web Hosting, Domain Name Registration - MyDomain.com ?name1=value1&name2=value2
how can I get the value of name1 and name2?
And then I want to put the value of name1 and name2 into a link, eg. https://www.otherdomain.com/index.html
How to do them in wix?

Hi,
you can use this code to extract url parameters :

let url_string = window.location.href
let url = new URL(url_string);
let c = url.searchParams.get("c");
console.log(c);

Thanks, Moshe