jQuery Ajax returns error in IE9 with RSS XML -


i have aspx page generates rss xml this:

<?xml version="1.0" encoding="utf-8"?> <rss version="2.0"> <channel>     <title>title</title>     <link>http://www.mysite.com/news</link>     <description>an rss feed latest news articles.</description>     <language>en-us</language>     <ttl>60</ttl>     <image />     <lastbuilddate>thu, 11 jul 2013 16:44:10 gmt</lastbuilddate>     <item>         <title>the future of news</title>         <image>/uploadedimages/news/articles/blog.jpg?n=104</image>         <link>http://localhost/news/articles/5363/</link>         <pubdate>2029-01-11</pubdate>         <formatteddate>today ago</formatteddate>         <summary>where news in 30 years? check out sort of news think we'll making!</summary>         <description />     </item> ... </channel> </rss> 

i need call feed jquery file this:

$.ajax({    datatype: ($.browser.msie) ? "text" : "xml",    url: newsfeed,    cache: true,    error: function (xhr, ajaxoptions, thrownerror) {     alert(xhr.status);     alert(thrownerror);    }    success: function (data) {    ... 

the code works in firefox , chrome fails in ie9. in ie9 triggers error condition , displays 2 alerts both "error".

the "newsfeed" variable has value of "h t t p ://localhost/source/fixed/newsrss.aspx" (please note there no spaces in "http" won't let me submit without doing that) have confirmed using alert.

elsewhere saw ie doesn't "xml" datatype has use "text" instead.

i running site localhost there should not cross domain scripts.

the solution problem involved detecting web browser being used. if browser ie instead of using jquery ajax used ie's xmlhttprequest. here code:

var xhreq = new xmlhttprequest(); xhreq.open("get", "/source/handlers/search.ashx?q=" + val + "&d=" + dateobj.gettime(), false); xhreq.send(null); ajaxsuccess(xhreq.responsetext); 

the ajaxsuccess method contains same javascript called upon successful execution of jquery ajax code.

so got working don't know why ie didn't jquery approach.


Comments