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.
Apparently the Postman app can order CORS without Browser stopping it. I found an answer from Soen who talks about it and points to a Support page of Chrome where it refers how to configure Urls usage outside the domain.
– Sergio
Thanks @Sergio. I’ll try this.
– Stanley Gomes