Forum Moderators: open
I am very new to Ajax, and recently encounted a problem that I could not solve. I have read many tutorials but found no solution. The problem is quite simple, and any help is appreciated!
I have a simle xml structure that I want to parse via responseXML
<root>
<data>a</data>
<data>b</data>
<data>c</data>
</root>
The code trying to parse this information is
var xmldoc = http_request.responseXML;
var x = xmldoc.getElementsByTagName('root');
var y = x[0];
for (j=0;j<y.childNodes.length;j++) {
if (y.childNodes[j].nodeType!= 1) continue;
var o = document.createElement("option");
o.innerHTML = '<option>'+y.childNodes[j].firstChild.nodeValue+'</option>';
o.value = y.childNodes[j].firstChild.nodeValue;
select.insertBefore(o, null);
}
This code runs fine under Firefox, but refuse to work for IE no matter what I try. Any suggestions? Thanks in advance.
Lazyfish
Some more information would help in figuring out where the problem lies. What exactly do you mean by "it refuses to work"? Do you get an error message? Do you have Javascript error reporting turned on in IE? Does just nothing happen? Have you tried putting alert(variable) statements in at various points in the code to see how far it's getting before the problem begins?