Control form success and failure responses

Hello!

Sorry for the trouble, but I am a developer which never worked with Webflow before.

Basically what I wanna know:

I got this form block:

      <div class="col w-col w-col-6">
            <div class="contact-form w-form">
                <form data-submitform="" data-name="Contato" id="wf-form-Contato" name="wf-form-Contato">
                    
                    <label for="Nome">Nome</label>
                    <input class="input w-input" data-name="Nome" id="Nome" maxlength="256" name="nome" placeholder="Digite seu nome" type="text">
                    <label for="email">E-mail</label>
                    <input class="input w-input" data-name="Email" id="email" maxlength="256" name="email" placeholder="Digite seu email" required="required" type="email">
                    <label for="Telefone">Telefone</label>
                    <input class="input w-input" data-maskphone data-name="Telefone" id="Telefone" maxlength="256" name="telefone" placeholder="Telefone com DDD" type="text">
                    <input class="submit w-button" data-wait="Aguarde..." type="submit" value="Enviar" wait="Aguarde...">
                </form>
                <div class="form-success w-form-done">
                    <div>Obrigado! Sua mensagem foi enviada com sucesso. Em breve um de nossos consultores entrará em contato.</div>
                </div>
                <div class="form-error w-form-fail">
                    <div>Oops! Parece que algo deu errado. Confira as informações e tente novamente mais tarde.</div>
                </div>
            </div>
        </div>

Webflow then hides the form and shows always the success messages. What I want is this: I will make an AJAX Request and dependending on the AJAX response I want to show the correct message.

if(ajax_request() === true) {
    webflow_please_show_success_message();
}else{
    webflow_please_show_error_message();
}

I notice that it is controlled by webflow.js but I couldn’t find any documentation on the web on the matter. Help?

PS: Insert here obligatory “sorry for the bad english”.