I have some code that works in preview but not in publish. The code below will insert fields into a new row in my database in preview mode. But nothing happens in the published site. What am I doing wrong?
let toInsert = {
“urlDescription” : URLDescription,
“userid” : userid,
“meritbadge” : “MERITBADGE” ,
“requirement” : “REQUIREMENT”
};
wixData.insert( “helpfulclicked” , toInsert)
.then( (results) => {
let item = results; //see item below
console.log( “Worked” )
console.log( “D” );
$w( “#text27” ).text = “made it” ;
} )
. catch ( (err) => {
let errorMsg = err;
console.log( “error” );
console.log(errorMsg);
$w( “#text27” ).text = “ERROR” ;
} );
$w( "#dataset3" ).save();