Forum Moderators: open

Message Too Old, No Replies

Simple Ajax problem on IE, please help!

can't get it to work under IE

         

lazyfish

6:51 am on Dec 14, 2006 (gmt 0)

10+ Year Member



Hi,

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

MichaelBluejay

8:48 am on Dec 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hello, and welcome to WebmasterWorld!

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?

lazyfish

6:35 am on Dec 20, 2006 (gmt 0)

10+ Year Member



Hi Michael,

After much struggle, I found out that the file output was not really a proper xml file (i.e. a file without the proper header). Somehow it was fine on Firefox. Thanks anyway =P

Lazyfish