Here’s my code:
$w.onReady(function () {
let randomItem;
let randTitle;
wixData.query("RandomLinks")
.find()
.then( (results) => {
let randomNumber = Math.floor((Math.random() * results.items.length));
randomItem = results.items[randomNumber];
randTitle = randomItem.title;
});
$w('#button13').label = randTitle;
});
The problem is I keep getting this error:
“Wix code SDK Warning: The label parameter of “button13” that is passed to the label method cannot be set to null or undefined.”
Real quick: Yes, title is the field key and not the name of the field, so that’s not it! Have tried all kinds of hacks, but cannot get that random title to take. Any ideas?