views:

1166

answers:

2

I want to pull an RSS feed via jQuery AJAX, but every time I do, I get a parsererror. My feed is relatively complex (using CDATA and custom namespaces), so I tried stripping down the document returned (along with a million other combinations), but even with an extremely simple document, it still fails. 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>
A: 

I have a similar problem - it works when the content type is application/xml or text/xml but not when it is application/rss+xml. Fine in FF, but not IE8. Any ideas?

Chris
A: 

@Chris application/rss+xml must not be recognized by jQuery as an XML content type. Consider posting your issue as a separate stack overflow question, or submitting a bug with jQuery.

ysimonson