i have Field key (id) and the value from $w('#input3').value
wen i click the button3 the first time the Result undefined
The second button3 Run will give me the results
the link
https://ammar0553.wixsite.com/alotair/login
let sname,sendto,numberr,pas;
export function button3_click() {
$w('#text49').show();
$w("#dataset3").setFilter( wixData.filter()
.eq("id", $w('#input3').value )
)
.then( () => {
let itemOb = $w("#dataset3").getCurrentItem();
sname = itemOb["name"];
sendto = itemOb["title"];
numberr = itemOb["number"];
pas = itemOb["userpass"];
} )
.catch( (err) => {
console.log(err);
} );
console.log(numberr);
console.log(sname);
let message = mes1 + "\n" + sname + "\nإسم المستخدم : " + sendto+ "\nكلمة المرور : " +pas + "\n" + mes2;
fullUrl = first + namee + ul11 + apa + ul12 + numberr + ul13 + usen + ul14 + message + lasturl;
var uri = fullUrl;
var tt = encodeURI(uri);
console.log(tt);
fetch(tt, {
method: 'post',
mode: 'no-cors',
headers: {
'Content-Type': 'application/json'
} });
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
$w('#text49').hide();
$w('#input3').hide();
$w('#button3').hide();
$w('#loginButton').show();
$w('#text48').show();
$w('#input1').show();
$w('#input2').show();
}, 2000);
Thus fix my issue
export function button3_click() { $w('#text49').show(); $w("#dataset3").setFilter( wixData.filter() .eq("id", $w('#input3').value ) ) .then( () => { let itemOb = $w("#dataset3").getCurrentItem(); sname = itemOb["name"]; sendto = itemOb["title"]; numberr = itemOb["number"]; pas = itemOb["userpass"]; } ) .catch( (err) => { console.log(err); } ); let debounceTimer3; if (debounceTimer3) { clearTimeout(debounceTimer3); debounceTimer3 = undefined; } debounceTimer3 = setTimeout(() => { console.log(sname); console.log(sendto); console.log(numberr); console.log(pas); let message = mes1 + "\n" + sname + "\nإسم المستخدم : " + sendto+ "\nكلمة المرور : " +pas + "\n" + mes2; fullUrl = first + namee + ul11 + apa + ul12 + numberr + ul13 + usen + ul14 + message + lasturl; var uri = fullUrl; var tt = encodeURI(uri); console.log(tt); fetch(tt, { method: 'post', mode: 'no-cors', headers: { 'Content-Type': 'application/json' } }); }, 2000); if (debounceTimer) { clearTimeout(debounceTimer); debounceTimer = undefined; } debounceTimer = setTimeout(() => { $w('#text49').hide(); $w('#input3').hide(); $w('#button3').hide(); $w('#loginButton').show(); $w('#text48').show(); $w('#input1').show(); $w('#input2').show(); }, 2000); }