Input Value Redirect

@russian-dima Hmmmm,

When I choose the number and press the button nothing happen.

No errors in Dev console . No errors in Chrome console.

Only ( My value setted! , Button-1 clicked! )

import wixData from 'wix-data';
import wixLocation from'wix-location';

let myValue  

$w.onReady(()=>{ 
  $w('#input1').onChange(()=>{console.log("My value setted!") 
    myValue=setTimeout(()=>{$w('#input1').value},100);
 }); 
 
  $w('#button1').onClick(()=>{console.log("Button-1 clicked!") 
    searchIndex(myValue) 
 }); 
});

function searchIndex(VALUE){// VALUE = value from your inputfield.
 let DATAFIELD = "index" //<put in here the ID of your DATAFIELD (INDEX)
  wixData.query("SitesID") //<---- put in here the ID of your new DB !
 .eq(DATAFIELD, VALUE) //<---- This one is new and will do the filtering !
 .find()
 .then((results) => {
 let items = results.items
 if(items.length > 0) {
 let myURL = results.items[0].url; console.log(myURL)
      wixLocation.to(`${myURL}`); 
 } else {
 // handle case where no matching items found
 }
 })
 }