top of page

28.8.19

זכירת מידע שהוכנס במעבר בין דפים

איך לזכור נתונים ללא שימוש בבסיס נתונים בוויקס קוד?

לעיתים יש צורך לזכור אך עדיין לא לשמור מידע שהוזן ע"י הגולש במעבר לדף אחר.  את המידע אנחנו מעונינים להכניס לסביס נתונים רק בסוף התהליך במידע והלקוח סיים אותו

לדוגמא מעבר דף בעת הזמנת כרטיסים.

הקוד:

On the first page, I've created an input box and a button, then added the following code:

import {local} from 'wix-storage'; 

import wixLocation from 'wix-location';   

export function button1_click(event, $w) {

      local.setItem('name', $w('#input1').value);

     wixLocation.to('/storage'); //==> this moves to the second page we've created }   


Then, on the second page ("storage"), I've added a text component and the following code, to display the value filled into the text box from the first page:


import {local} from 'wix-storage';

  $w.onReady(function () {

     $w('#text1').text = local.getItem('name'); 

});

bottom of page