Estoy trabajando con jquery y servlet en java y al intentar hacer la conexión a un método me manda el siguiente error.
http://localhost:8080/AtnMedicaWeb/atencion/prueba: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.
Este es mi método para conectar:
$.ajax({
type: "POST",
url: "http://localhost:8080/AtnMedicaWeb/atencion/prueba",
headers: {"Content-Type": "application/json", "Accept": "application/json", 'Access-Control-Allow-Origin' : 'http://localhost:8080'},
success: function(response){
},
failure: function(){
//location.href = "index.html";
}
});
file://
)