I ask for your help with this problem:
I need to pass the value stoEmpresa from Page 1 to Page 2.
The code I use in Page 1 is:
import {session} from ‘wix-storage’
export function buttonAgregarInscripcion_click(event) {
let EmpresaActual = $w(" #textEmpresa ").text; session.setItem(“stoEmpresa”,EmpresaActual) }
When I try to retrieve the value in other page, the value is null. This is the code in Page 2:
import {session} from ‘wix-storage’
let EmpresaTraido = session.getItem(“stoEmpresa”);
What can I do?
Arturo
First of all I can’t see all code in your pages so I don’t know if you have the code within onready or outside that code. Then I don’t know if you redirect the user after you have stored it, then I would guess the code had no time to store it before you redirect them and then you will have to await storing before using redirect.
Also remember to always end your lines with semicolon to make sure all rows get executed ;
Hi Avillarg,
Your code Works fine for me, setting/getting the session value is fine. Can you double check it and be sure to start from the page where you set the EmpresaActual - session item - .
Best,
Mustafa
Mustafa, I’ll check it. Thank you!
Andreas, thank you for your answer!