I have written a code to show a desire output from database when any input is filled and it is working absolutely fine in preview mode but when I publish the website it is showing different result.
This is what it shows in preview mode
This is what it showing in published website
why such difference? Code:
// For full API documentation, including code examples, visit https://wix.to/94BuAAs
import {search} from 'backend/dquery';
$w.onReady(function () {
$w("#text45").hide();
$w('#text44').hide();
$w('#box1').hide();
$w("#button7").onClick( (event) => {
$w("#input14").inputType = "number";
let ID=$w("#input14").value;
const ID1=parseInt(ID.valueOf());
console.log(ID1) // "myElement"
search(ID1).then(result => {
console.log(result);
$w('#text45').show();
$w('#box1').show();
$w('#text44').show();
$w('#text45').text=result;
// Logs: 20
})
.catch(error => {
console.log(error);
});
} );
//TODO: write your page related code here...
});
export function button1_click(event) {
//Add your code for this event here:
}
Make sure the sandbox and the live collection are in sync.
Make sure the collection permissions are correctly set.