Hi
I am trying to call an image from a database that the user have created and stored into ‘Purchase’ database, using data wix query, and then save the image src into a new variable., this is my code so far:
import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;
$w . onReady ( function () {
id = wixUsers . currentUser . id ;
$w ( "#dataset4" ). setFilter ( wixData . filter (). eq ( 'user' , id ))
let showImage = wixData . query ( “Purchase” )
. eq ( ‘user’ , id )
. find ()
. then ( ( results ) => {
let item = results . items [ 3 ];
let image = item . images ;
$w ( ‘#image1’ ). src = image ;
} );
});
i need to change the image that is on the page to the one from the database, can someone tell me if my code is correct or should i try other method?