How to wait for fetch to be over?

Hello siluk,

if you want …

REQUEST SENT
POSTING TO CRM COMPLETED
FORM SUBMITTED

then your first function —> “submitButtonClicked” should look like this…

function submitButtonClicked () {
    submitForm()
    .then(()=>{
        console.log("FORM SUBMITTED")
    })   
}

or…

async function submitButtonClicked () {
    await submitForm()
    console.log("FORM SUBMITTED")
}

I did not test it, just theoretical thoughts. Try it out.