[thelist] JavaScript/Ajax - responseText and IE question

Matt Warden mwarden at gmail.com
Thu Mar 2 12:51:18 CST 2006


On 3/2/06, Tom Dell'Aringa <pixelmech at yahoo.com> wrote:
> response = request.ResponseText;     <-- this is okay
> m = document.getElementById('msg');
> m.innerHTML = response;              <-- this errors out!?!?!
> For some reason IE does not like the string of text? I tried toString() with no luck...


I'm not sure how to help you, because I avoid innerHTML like the plague.

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()) {

    var p = document.createElement('p');

Matt Warden
Miami University
Oxford, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list