I'm trying to use a text element - link to navigate between pages on my site. I want to use Velo code to send session variable information to the next page. I set up the text element with an onClick event handler that creates an export function. In the function I set the session variable. I also have the text elements link property set to go to the new page. Problem is when I click on the text-link it takes me to the new page alright but the session variable information in the export function does not get updated (executed).
Would appreciate any help with what I'm doing wrong or what I need to do to make this work. Thanks
Hey @statsportsgames! To send data between pages, there's a couple of ways of achieving it - session storage; databases; params. The problem you're facing is the text is linked directly on the element rather than via code. You'd need to use the wixLocation to() API to navigate to the page - https://www.wix.com/velo/reference/wix-location/to Something like
$w("#button").onClick(() => { session.setItem("key", "value"); wixLocation.to("/page") })
The Velo forum or Velo Discord might be a good alternative for code help
what kind of data ? you can use query params in combination with Wix Location to() https://www.wix.com/velo/reference/wix-location/to