Request on Postman (Chrome extension) works, but with ajax no

Asked

Viewed 427 times

1

I am making a request to a private API via POST. First I did the tests via Postman extension, everything went well.

Without following I did tests with the request via ajax and it does not work the same way.

Restangular.oneUrl("app" , "meutoken").get().then(function (data){
    var tokenF = data; //aqui eu trago um token desta api, e ele realmente vem

    //aqui eu envio o POST
    $.ajax({
        type : "POST",
        url : "formulario",
        data : {
            nome : formulario.nome,
            email : formulario.email,
            telefone : formulario.telefone,
            assunto : formulario.assunto,
            mensagem : formulario.mensagem,
            tokenForm : tokenF
        },
        async : false,
        success : function (data){
            alert(data.mensagem)
        }
    });
});

Following by Chrome’s Veloper tools, I see that all parameters have been sent, but the server’s response is that the tokenF is not being sent, but the other fields are.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.