I want to pull the RSS feed through jQuery AJAX, but every time I do this, I get a parsererror. My channel is relatively complex (using CDATA and custom namespaces), so I tried to hide the returned document (along with millions of other combinations), but even with a very simple document it still doesn't work. This is my AJAX code:
$.ajax({
type: 'GET',
url: ...,
dataType: 'xml',
success: function(xml) {
...
},
error: function(xhr, textStatus, error) {
console.log('status: ' + textStatus);
console.log(xhr.responseText);
showError('an unknown error occurred while trying to fetch the feed: ' + xhr.status);
}
});
Console output:
status: parsererror
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>title</title>
<link>link</link>
<description>desc</description>
<lastBuildDate>build date</lastBuildDate>
<generator>gen</generator>
</channel>
</rss>
source
share