I am tring to call to an API from my script, for some reason it does not wait for a response, it just moves past, anyone have any idea as to what I am doing wrong?
async function checkForValid() {
alert('gothere');
let url = 'https://site.com/api/v2/customers/' + document.getElementById(cuid_id).value;
let key = 'dafdsfas_dgsfgsdfgfdsfd_dsfsd';
(async () => {
let checkLogin = await fetch(url, {method:'GET', headers: {'Authorization': 'Basic ' + btoa(key + ':')}});
data = (await checkLogin.json())
alert(data);
})();
alert(data);
}
I left in my test spots.
when i run this it gets to the ‘gothere’ but then just moves on by…