[thelist] JavaScript/Ajax - responseText and IE question

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Thu Mar 2 15:31:46 CST 2006


Did you get around to trying the different content type?

 From: Tom Dell'Aringa pixelmech at yahoo.com

--- Matt Warden wrote:

> I'd suggest altering your PHP output by removing the ' 

' and ''
> tags, such that it is only outputting the string of text. Then change
> your JavaScript to something like this:
> 
> response = request.responseText;
> if (m && document.createElement) {
> while (m.hasChildNodes()) {
> m.removeChild(m.firstChild);
> }
> 
> var p = document.createElement('p');
> p.appendChild(document.createTextNode(response));
> m.appendChild(p);
> }

Well, shortly after it was working - it wasn't. Go figure. So I replaced the innerHTML with Matt's
suggestion above, and it works fine. So there you have it, IE can sometimes choke on innerHTML for
some unknown reason - good to know.

Tom



More information about the thelist mailing list