Hi, im a new user, and fairly new to ajax.

I'm trying to create a blog that uses RSS. The problem is that google chrome displays the results from the rss.php script, yet Internet Explorer does not. Any help would be greatly appreciated.

Here are the functions i am using for the communication to the script and the parsing of the XML returned. (as you can see I have gone backwards to just trying to get the title tag of the XML tags to display... still nothing in IE).

var loaded = 3;

function ajaxrequest2()

    var request2 = new Ajax.Request
            { method: 'get',
              onComplete: rssReturned }

function rssReturned (xmlHTTP2)
    var itemsArray = xmlHTTP2.responseXML.getElementsByTagName("item");
    var html="";
	var ilength = itemsArray.length;
	for(var count=0; count<ilength&&count<loaded; count++)
		var title = itemsArray[count].getElementsByTagName("title")[0].firstChild.nodeValue;
                html=html+"<div class='rsstop'>"+title+"</div>";


	document.getElementById("blogcontent").innerHTML = html;

Here is the RSS.php Script:


header("Content-type: application/rss+xml");


$query = "SELECT * FROM `stories` ORDER BY `id` DESC";


echo "<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'>";
echo "<channel>";
echo "<title>Mightydrive</title>";
echo "<link>http://mightydrive.co.uk/rss.php</link>";
echo "<description>Latest goings on with Mightydrive</description>";

echo "<atom:link href='http://localhost/mightydrive/rss.php' rel='self' type='application/rss+xml' />";

    echo "<item>";
    echo "<title>".$row['title']."</title>";
	echo "<category>".$row['category']."</category>";
    echo "<link>http://mightydrive.co.uk/fullstory.php?id=".$row['id']."</link>";
    echo "<description>".$row['description']."</description>";
	echo "<author>".$row['author']."</author>";

    // This line converts a database date format 
    // (e.g. 2006-09-22 12:30:00) to an RSS date
    // (e.g. Fri, 22 Sep 2006 12:30:00 GMT)

    $rssdate = date("D, j M Y H:i:s", strtotime($row['pubDate'])). " GMT";

    echo "<pubDate>".$rssdate."</pubDate>";
	echo "<guid>http://mightydrive.co.uk/blog.php?id=".$row['id']."</guid>";
    echo "</item>";

echo "</channel>";
echo "</rss>";

Sorry if i've missed anything out... any help would be greatly appreciated.



The problem is almost certainly the absence of the 'text/xml' header required by IE. An easy work-around is to add a cross-browser intermediate step

function rssReturned(xmlHTTP2) {

    if (window.ActiveXObject) { // sniff for IE Windows
        var XMLdoc = new ActiveXObject("Microsoft.XMLDOM");
    } else {
        var XMLdoc = xmlHTTP2.responseXML;

    var itemsArray = XMLdoc.getElementsByTagName("item");
    var html = "";
    var ilength = itemsArray.length;
    for (var count = 0; count < ilength && count < loaded; count++) {
        var title = itemsArray[count].getElementsByTagName("title")[0].firstChild.nodeValue;
        html = html + "<div class='rsstop'>" + title + "</div>";
    document.getElementById("blogcontent").innerHTML = html;

Thank you very much!!! :) that has solved the problem.

I can now progress with the site.

Cheers again!