I am trying to call an async function inside another function. However, when I click on the network tab, it ain't creating any post request. What can be the issue here?
var onComplete = function() {
// CALLING THE ASYNC FUNCTION HERE ---> { NOT WORKING }
updateProfile()
}
async function updateProfile(){
var dataString = {
name: questions[0].answer,
gender: questions[1].answer,
dob: questions[2].answer,
country: questions[3].answer,
interested: questions[4].answer,
};
let xhr = new XMLHttpRequest();
xhr.open("POST", "processes/onboard.php", true);
xhr.onload = ()=> {
if(xhr.readyState === XMLHttpRequest.DONE) {
if(xhr.status === 200) {
// SUCCESS
}
}
}
let formData = new FormData(form);
xhr.send(JSON.stringify(dataString));
}