Hello:
I am pretty new to Ajax. I'm trying to put some specific portions of an XML file into a div on my page, and the following works in every recent browser except IE:
var xhr = false;
//Executed to request content from the server
function setContent(){
if(window.XMLHttpRequest){
xhr = new XMLHttpRequest();
} else {
if(window.ActiveXObject){
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
}
xhr.onreadystatechange = showContent;
xhr.open("GET", "ajax/art.xml", true);
xhr.send(null);
}
//Executed to set the appropriate text once the server has gathered the data
function showContent(){
if(xhr.readyState == 4){
if(xhr.status == 200 || window.location.href.indexOf("http") == -1){
var newData = xhr.responseXML.getElementsByTagName(curPage).textContent;
}
var textBox = document.getElementById("textBox");
textBox.innerHTML = newData;
}
}
(The value of curPage is set elsewhere in the code and seems to have the correct value) When I execute this code in IE on the server I get the word "undefined" in the textBox Div instead of the content grabbed from the XML document. How do I resolve this?
Thanks in advance <><