Do anyone know why the variable “Canje” is changed in the query, but when I click the button 12, the value Canje looks like it doesnt exist?
import wixLocation from 'wix-location'
import wixData from 'wix-data'
var Canje = 0;
$w.onReady(function () {
wixData.query("Vales").contains('dni', $w('#input14').value)
.count()
.then( (num) => {
Canje = num;
$w('#input19').value = Canje
} )
.catch( (error) => {
let errorMsg = error.message;
let code = error.code;
} )
});
export async function button12_Click() {
Here it runs more code but its not necessary for the explanation
if ( Canje === '0'||Canje <'0') {
$w('#button14').enable()
}
if (Canje >'0') {
$w('#button14').disable()
$w('#button15').disable()
$w('#button14').label = "VALE YA CANJEADO"
}
}