I am making a cross-origin request using the jQuery 1.8.3 Ajax function. The code below always returns "fail" but "200 OK" is logged for each Ajax request in the console log. Given that the log shows a status of 200, shouldn't the success function be performed? How can I get the success function to be performed when a status of 200 is returned?
$().ready(function() {
var checkIt = function(checkURL, resultP) {
$.ajax({
url: checkURL,
type: 'GET',
cache: false,
success: function() {
$(resultP).text("ok");
},
error: function() {
$(resultP).text("fail");
}
});
};
checkIt("https://firstURL", "#p1p");
checkIt("https://secondURL", "#p2p");
checkIt("https://thirdURL", "#p3p");
)};
The console log shows the following (Each request has a 200 response)
[10:03:37.898] GET https://firstURL [HTTP/1.1 200 OK 141ms]
[10:03:37.898] GET https://secondURL [HTTP/1.1 200 OK 141ms]
[10:03:37.898] GET https://thirdURL [HTTP/1.1 200 OK 141ms]
Thanks!