I'm trying to retrieve some XML from the Gmail API. I have this so far:
$.ajax({
url: "https://mail.google.com/mail/feed/atom/",
success: function(data) {
console.log(data.responseText);
}
});
I know for sure that the array data has a value called responseText
because the console tells me so when I get my code to log data. However, when I try to log data.responseText
, it logs data and ignores the fact that I specified a parameter (it doesn't say that responseText is not defined). What am I doing wrong?
Edit: here is a screenshot of what the console says data
is:
Edit, in response to Kevin: I tried this:
$.ajax({
url: "https://mail.google.com/mail/feed/atom/",
dataType: "xml",
success: function(data) {
console.log($("feed fullcount",data).html());
}
});
it says that it "Cannot call method 'replace' of undefined" :o
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With