So I have a jQuery ajax request, and when it fires I get the Access-Control-Allow-Origin problem. The server I'm sending it to is not under our management, but is an API that is supposed to accept POST requests.
What's really weird is that even when I get this error, if I go to Chromes Network tab, click on the request and then Preview or Response, I see the data I need.
Is there no way to get this data from the request since ajax is saying it failed?
I can't do jsonp by the way.
ajax call
$.ajax({
url: url,
type: 'POST',
data: body,
dataType: 'json',
success: function(data) {
console.log(data);
},
error: function(xhr, status, error) {
console.log(xhr.responseText);
console.log(status);
console.log(error);
},
complete: function(xhr, status){
console.log(xhr, status);
}
});
The browser code is 200, and I can see the data I need to access right there in the tab. But it's no where in the console from all this.