I am working with jquery and servlet in java and trying to connect to a method sends me the following error.
link : Response to preflight request does not 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.
This is my method to connect:
$.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";
}
});