
shubhamtotla007
I want to create BUY NOW button such that when a user clicks it the item from the database collection is removed. So can you help me out with the below code
import wixData from ‘wix-data’;
$w.onReady( function () {
//TODO: write your page related code here…
$w(“#dynamicDataset”).onReady( () => {
$w(“#button6”).onClick( (event) => {
let $item = $w.at(event.context);
let clickedItemData = $item(“#dynamicDataset”).getCurrentItem();
wixData.remove(‘ADDS’, clickedItemData)
.then( (results) => {
let item = results; //see item below
} )
. catch ( (err) => {
let errorMsg = err;
} );
} );
});
});