top of page

HOME PAGE CODE:  Change ID names to match the elements on your page.

THE CODE

import {local} from 'wix-storage';

import wixLocation from 'wix-location';

 

$w.onReady(function () {

});

 

export function searchButton_click() {

    let word = $w("#searchBar").value;

    local.setItem("searchWord", word);

    wixLocation.to(`/results`);

}

RESULTS PAGE CODE:  Change ID names to match the elements on your page & Database field key names.

THE CODE

import {local} from 'wix-storage';

import wixData from 'wix-data';

 

$w.onReady(function () {

    var sameWord = local.getItem("searchWord");

    $w("#searchBar").value = sameWord;

    $w("#searchBar").placeholder = sameWord;

    $w('#nameDataset').onReady(function () {

        search();

    });

});

 

export function searchButton_click() {

    search();

}

 

function search() {

    wixData.query('Name')

   .contains('name', $w("#searchBar").value)

   .or(wixData.query('Name').eq('number', $w("#searchBar").value))

      .find()

       .then(res => {

  $w('#repeater1').data = res.items;

    });

}

bottom of page