So I have a peculiar issue with my AJAX request. When I make the request, I can click on the network tab and see the response, which is valid JSON. But when I try to use that data in my success function of the ajax call, it returns undefined. I'll post some pics of my console and network tab and some code.
And at last my code:
getWebinars: function (from, to, credential) {
$.ajax({
url: 'endpoint',
data: {
from: from,
to: to,
credential: credential
},
success: function (reply, status, xhr) {
console.log(reply);
var html = '<select class="webinars" multiple>';
for(var webinar_id in reply.list) {
html+= '<option value="' + webinar_id + '">' + reply.list[webinar_id] + '</option>';
}
html+= '</select>';
$('.modal-body').append(html);
}
});
}
I can't figure out for the life of me what the issue is here. I have tried everything I can think of. Logging the xhr, logging the responseJSON, setting the datatype to json. It's a simple get request and it's working, but the console doesn't seem to think so. Any help is appreciated.