Hello,
I've used pretty much this same code in projects before with no problem, however, this time around, I can't get a status=200. I've alerted several things, and the responseXML comes back null in FF (2/3), object in IE (6/7), while the responseText comes through just fine in both.
I've tested it both locally and on a web server. I've been searching for answers on this, and it points to it not being recognized as XML, even though it passed a validator.
XHR part:
=============================================
XML File
=============================================
====================================
Any help is appreciated, and insults probably deserved
I've used pretty much this same code in projects before with no problem, however, this time around, I can't get a status=200. I've alerted several things, and the responseXML comes back null in FF (2/3), object in IE (6/7), while the responseText comes through just fine in both.
I've tested it both locally and on a web server. I've been searching for answers on this, and it points to it not being recognized as XML, even though it passed a validator.
XHR part:
Code:
<script type="text/javascript">
var xmlHttp;
var requestType = "";
var images = null;
var alts = null;
var links = null;
var titles = null;
var currentPromo = null; // Helps build part of the block
var currentItem = 1; // Global variable that keeps track of the rotating items
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
xmlHttp.overrideMimeType('html/xml')
}
}
function startRequest() {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", "homeblock.xml", true);
xmlHttp.send(null);
alert(xmlHttp.responseXML);
alert(xmlHttp.responseText);
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
alert(xmlHttp.readyState);
if(xmlHttp.status == 200) {
listBlockItems();
alert(xmlHttp.status);
}
}
}
XML File
=============================================
Code:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Feed title</title>
<link>[URL unfurl="true"]http://www.google.com</link>[/URL]
<description>Description goes here</description>
<item>
<title>Item #1</title>
<link>[URL unfurl="true"]http://www.google.com</link>[/URL]
<description>Description #1</description>
<image>slide1.jpg</image>
<alt>Item #1 Image</alt>
</item>
<item>
<title>Item #2</title>
<link>[URL unfurl="true"]http://www.google.com</link>[/URL]
<description>Description #2</description>
<image>slide2.jpg</image>
<alt>Item #2 Image</alt>
</item>
<item>
<title>Item #3</title>
<link>[URL unfurl="true"]http://www.google.com</link>[/URL]
<description>Description #3</description>
<image>images/slide3.jpg</image>
<alt>Item #3 Image</alt>
</item>
<item>
<title>Item #4</title>
<link>[URL unfurl="true"]http://www.google.com</link>[/URL]
<description>Description #4</description>
<image>slide4.jpg</image>
<alt>Item #4 Image</alt>
</item>
</channel>
</rss>
Any help is appreciated, and insults probably deserved