setNewItemData1 function question.
hello. This function works just fine when I call it from the console after entering a number in the html page for the Tunacan.price, as it updates the moralis object database perfectly.
but WHY does the function NOT work when it is called separately within the .js file? I tried calling it in the file like I have illustrated in the //commented out line. Nothing happens. I checked to make sure that Tunacan.price was updated, but the moralis database does not update. Plus I get this message:
moralis.js:23794
Uncaught (in promise) Error: You need to call Parse.initialize before using Parse.
at Object.generatePath (moralis.js:23794)
at Object.currentInstallationId (moralis.js:1317)
at Object.request (moralis.js:23275)
at Object.find (moralis.js:19621)
at ParseQuery.value (moralis.js:17694)
at setNewItemData1 (itembancentry.html:280)
at itembancentry.html:286
Thank you in advance for your review.
<script>
setNewItemData1 = async () => {
const query = new Moralis.Query('Items');
query.equalTo("name", "tunacan")
const tunacan = await query.first();
if(tunacan){
tunacan.set("price", Tunacan.price);
await tunacan.save();
}
}
//setNewItemData1();
</script>