I created a very simple rest API and following the sample on this other post : HERE I made an ajax call to my API but for some reason I get undefined as a response. I think I'm doing something wrong in the call.
Here is the call:
$( document ).ready(function() {
FetchData();
});
function FetchData() {
$.ajax({
async: false,
type: "GET",
url: "http://austinwjones.com/radio/gunsmoke/read.php",
dataType: "json",
success: function(data, textStatus, jqXHR) {
$.each(data, function(i, object) {
console.log(data.records.epi);
});
},
error: function() {
}
});
}
By directly going to my API Here you can see there is a result. I suspect my issue is with this part?
success: function(data, textStatus, jqXHR) {
$.each(data, function(i, object) {
console.log(data.records.epi);
});
Any help is appreciated.