JQuery ajax() get xml response text
data
is not an xhr object, it is your xml string converted into an XML Document
. Therefore, it doesn't have a responseText
property unless the xml doc has a responseText node. Also, add dataType: "xml"
to your ajax options if you are expecting xml.
$.ajax({
url: "https://mail.google.com/mail/feed/atom/",
dataType: "xml",
success: function(data) {
console.log(data);
}
});
Edit: Now i see in your question (after edit) that it is infact an xhr object... That's odd...
If you just want a text format response to show,
you can simply do dataType: "text",
$.ajax({
url: "https://miranda-zhang.github.io/cloud-computing-schema/v1.0/ontology.xml",
dataType: "text",
success: function(text) {
$('textarea').val(text);
},
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<textarea cols="60" rows="10"></textarea>
Try data.responseText[0] instead of data.responseText.
EDIT: https://mail.google.com/mail/feed/atom/ It asks me to log in.