I´m trying to access a REST service using the post method but I get this response.
XMLHttpRequest cannot load http://192.168.0.13:8090/PruebaRestEjemplo/api/entidades.usuarios. Request header field Content-Type is not allowed by Access-Control-Allow-Headers.
But the content type header is allowed, I can try my services with postman and I get no error. What can it be? this is my code.
var prueba = new Object();
prueba.nombreUsuario = "Miguel";
prueba.apellidoUsuario = "De Cervantes";
prueba.usuarioLogin = "MCervantes";
prueba.contrasenaLogin = "Mcervantes";
$.ajax
({
type: "POST",
url: url,
contentType:"application/json; charset=UTF8",
dataType:"json",
data: prueba,
async: false,
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', x.basicAuth(x.usuario, x.clave));
},
success: function(result){
callback(result);
}
});