I am working with Fetch api. I am facing scope problem for callback variable.
My Code is like this.
var check;
fetch('http://localhost/react_task/dunckelsecure/php/credentialscheck.php'
).then(function (res) {
return res.text();
}).then(body => {
console.log('body is ', body);
// update
check = "hey";
});
// how to declare value of check globally
console.log('set body contain value is', body);
How to get value of body outside that
Any help regarding this...
Update.. how to access check variable globally