J
jason.lucey
Hi,
I need some help figuring this out. I cannot get the xmlhttprequest
object to return responseXML or getAllResponseHeaders. responseText
works fine, but i'd rather use xPath than regular expressions to
populate some tables.
I'm using the XMLHttpRequest object for Mozilla and the
ActiveXObject("Msxml2.XMLHTTP") for IE.
Here is the javascript:
//script to load the xml doc using xmlhttprequest or xmlhttp
if(xDoc) {
xDoc.open("GET",url,false);
xDoc.setRequestHeader("Content-Type","text/xml");
if(window.ActiveXObject){
xDoc.send("");
} else {
xDoc.send(null);
}
if (xDoc.readyState==4) {
alert(xDoc.responseText); //works fine
var xHead;
xHead = xDoc.getAllResponseHeaders();
alert(xHead); //returns null
xDoc = xDoc.responseXML.xml;
alert(xDoc.length); //returns 0
} else {
alert("Error--readyState: " + xDoc.readyState);
}
}
Any help would be great.
thanks.
I need some help figuring this out. I cannot get the xmlhttprequest
object to return responseXML or getAllResponseHeaders. responseText
works fine, but i'd rather use xPath than regular expressions to
populate some tables.
I'm using the XMLHttpRequest object for Mozilla and the
ActiveXObject("Msxml2.XMLHTTP") for IE.
Here is the javascript:
//script to load the xml doc using xmlhttprequest or xmlhttp
if(xDoc) {
xDoc.open("GET",url,false);
xDoc.setRequestHeader("Content-Type","text/xml");
if(window.ActiveXObject){
xDoc.send("");
} else {
xDoc.send(null);
}
if (xDoc.readyState==4) {
alert(xDoc.responseText); //works fine
var xHead;
xHead = xDoc.getAllResponseHeaders();
alert(xHead); //returns null
xDoc = xDoc.responseXML.xml;
alert(xDoc.length); //returns 0
} else {
alert("Error--readyState: " + xDoc.readyState);
}
}
Any help would be great.
thanks.