@russian-dima We’re close to solve it.
The URL was found!
But the button isn’t redirect me.
import wixData from 'wix-data';
import wixLocation from'wix-location';
let myValue
$w.onReady(()=>{
$w('#input1').onChange(()=>{console.log("My value setted!")
myValue = Number($w('#input1')).value; console.log("My-Value: ", myValue)
});
$w('#button1').onClick(()=>{console.log("Button-1 clicked!")
searchIndex(myValue)
});
});
function searchIndex(VALUE){console.log("Searchfunction started.")// 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) => {console.log(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
}
})
}
BTW. Thanks for help I appreciate that! ![]()
Edit : The positive thing about my problem is that the whole website depends on redirecting so when you fix it you fixed everything! And you just have to work in design.