I do not know if i understand your project the right way, but i think you want to transfer data from SITE-A to SITE-B to use the transfered data on SITE-B.
What is wrong here???
Why you start —> uniqueDropDown2() , befor you get the needed values from wix-storage?
$w.onReady(function(){
NumberChange();uniqueDropDown2();
var sameDropDown = local.getItem("class2");
$w('#classDropDown').value = sameDropDown;
$w('#classDropDown').placeholder = sameDropDown;
var sameDropDown2 = local.getItem("number1");
$w('#numberDropDown').value = sameDropDown2;
$w('#numberDropDown').placeholder = sameDropDown2;
...
..
.
So normaly you have first to load the transfered data…
Use more console-logs to investigate & understand your own code.
What happens at which line of code?
And always ask yourself, what should be done first and what last in your code.
Try to think the logical way.
Are you able to use data, which did not has been loaded yet? → No you can’t!
$w.onReady(function(){
// ---> first setting all the values ....
var sameDropDown = local.getItem("class2"); console.log(sameDropdown);
var sameDropDown2 = local.getItem("number1"); console.log(sameDropdown2);
$w('#classDropDown').value = sameDropDown;
$w('#classDropDown').placeholder = sameDropDown;
$w('#numberDropDown').value = sameDropDown2;
$w('#numberDropDown').placeholder = sameDropDown2;
// ---> before starting some functions.....
NumberChange();
// ---> sending values direct way to function...
uniqueDropDown2(sameDropDown);
...
..
.
Doing it the direct way…
//Doing it the DIRECT way....
$w('#classDropDown').value = local.getItem("class2");
$w('#classDropDown').placeholder = local.getItem("class2");
$w('#numberDropDown').value = local.getItem("number1");
$w('#numberDropDown').placeholder = local.getItem("number1");
function uniqueDropDown2(VALUE){
wixData.query('LocomotiveLogsTest')
//.contains("class2",$w('#classDropDown').value) //<---old one
.contains("class2", VALUE) <--- new one
.ascending('number1')
.limit(1000)
.find()
.then(results=>{
const uniqueTitles =getUniqueTitles(results.items);
$w('#numberDropDown').options =buildOptions(uniqueTitles);});
functiongetUniqueTitles(items){const titlesOnly = items.map(item=> item.number1);return[...newSet(titlesOnly)];}functionbuildOptions(uniqueList){return uniqueList.map(curr=>{return{label:curr, value:curr};});}
}
.contains("class2",$w('#classDropDown').value) //<---old one
.contains("class2", VALUE) <--- new one
Yes both way can be used, depending on how your variables are declared!