display url parameters in html (on the page)

Hi,

since we can’t use php in wix i’m stuck at this one:

can anyone give me a example on how to get the parameters of a url shown as text on my site?

f.e. www.url.com?par1=abc&par2=xyz

I would like to use an iframe where i have something code like:

<...... ????....>

<.... ???? ....>

The result for the user would be:

abc

xyz

It should be a simple

It is. Use this: https://www.wix.com/corvid/reference/wix-location/query
like so:

let query = wixLocation.query;
let h1InnerText = query.par1;

//and then postMessage those values to html-component

And don´t forget to import wixLocation into your page.

Thanks a lot. In the mean while I also searched for it .

The solution I use is as follow:

  1. create the elements you need on the page (a text element (e.g. #text122), a input field for text (#input1), a input field radio button (#radioGroup1)).
    (these id’s are visible when you click the element, properties or left above the element it 's shown)
  2. go to the corvid code below in the site editor and add some code, this code will overwrite the content of the elements. In my case it is executed during onReady (what ever it means it works)

$w.onReady( function () {
let a = wixLocation.query.a
$w( ‘#input1’ ).value = a; //write value a in input field #input1
$w( ‘#text122’ ).text = a + " hello" ; //write value a with some text in text element #text122
$w( ‘#radioGroup1’ ).value = a; //select value in radio button
});

note: value “a” comes out of the url: e.g. www example com/website?a=testvalue

So … it works? Problem solved?

yes it works like described here above