[thelist] JavaScript/Ajax - responseText and IE question
Tom Dell'Aringa
pixelmech at yahoo.com
Thu Mar 2 15:28:49 CST 2006
--- Matt Warden <mwarden at gmail.com> wrote:
> I'd suggest altering your PHP output by removing the '<p>' and '</p>'
> 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
http://www.pixelmech.com/
http://www.crossandthrone.com/
Professor Rumford: 'But I still don't understand about hyperspace.'
The Doctor: 'Well, who does?'
K9: 'I do.'
Doctor: 'Shut up, K9!'
More information about the thelist
mailing list