Erik Bleifield
Erik Bleifield

Reputation: 11

Wix Velo - How can I pass in a URL parameter to a wix page, and grab that parm in javascript to use it on the page?

I am seeking to use a Wix page as a landing page. I need to pass in an email address as a URL parameter to the page and have it displayed on the page. How can I pass url parameters into a page - and how can I grab that parm in code? Can someone please point me to, or provide and example of this?

Upvotes: 1

Views: 3524

Answers (1)

Shan
Shan

Reputation: 958

Send your email in a parameter like https://[email protected]

Then use Wix Location Query to get the value of the parameter.

import wixLocation from 'wix-location';

$w.onReady(function () {
    let query = wixLocation.query['email'];
    let email = decodeURIComponent(query); //decode uri encoded values in readable format
    console.log(email); //this is your email
});

Upvotes: 2

Related Questions