I am using a dynamic page to embed a website. I am trying to query through the dynamic dataset to find which url should be linked for the current logged in member. My code is as follows:
$w.onReady(function () {
$w("#dynamicDataset").onReady(function () {
var user_email = wixUsers.currentUser.getEmail(); // this gets the email of the
// current user
$w("#html1").scrolling = "no";
wixData.query("calendarDataBase") // this is the key name of the dynamic dataset
.eq("title",user_email ) // "title" is the collection of emails
// theoretically this should find the item row where the
// user email matches the one in the database
.find()
.then( (results) => {
const saveit = results.items[0]
var url = saveit.calendar // "calendar" is the item that holds the url
$w('#html1').src = url; // sets the embedded website to the url
})
})
})
To my knowledge, everything works up until I try to retrieve “saveit.calendar”. I try logging the url in the console and i get “undefined”. Any help would be much appreciated. Thank you