While attempting to retrieve JSON data from a file on my server, I encountered an error that prevented the process from completing successfully. However, upon inspecting the error.responseText, I noticed that my data was actually present. What could be causing this issue?
This is the function I am currently using:
function getJson(url) {
var result;
$.getJSON(url, function(data){
console.log('success');
}).error(function(error){
result = error.responseText;
console.log("Error: " + result);
return result;
});
}
If anyone has insight into why this might be happening, please share your thoughts!