$.ajax({
url: urlString,
dataType: "json",
type: "GET",
success: function (data) {
alert(data);
},
error: function (jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
alert('Requested JSON parse failed.');
} else if (exception === 'timeout') {
alert('Time out error.');
} else if (exception === 'abort') {
alert('Ajax request aborted.');
} else {
alert('Uncaught Error.\n' + jqXHR.responseText);
}
}
});
This is my javascript file, which they use to access any information from the server. The urlString string is supplied and is correct. What I did was download .json from the server I was extracting and access it locally on my computer. When I go to access the file from the server, I continue to get the error jqXHR.status == 0. I am not sure how to fix this because I do not see anything bad in my code.
Can someone point me in the right direction to fix my mistake?
source
share