[thelist] SOLVED: XMLHttpObject, responseXML and MSIE

Kasimir K evolt at kasimir-k.fi
Sat Feb 12 07:29:53 CST 2005


Kasimir K / 2005-02-12 11:59
> I've been playing around with XMLHTTPObject [0]. What I want to do is 
> call a document fragment from the server side, and then append it to 
> existing document. With Firefox this happens nicely, the XMLHttpObject 
> calls back this:
> 
> function testCallBack(xho)
> {
>     var el = document.importNode(xho.responseXML.documentElement, true);
>     document.getElementById('stub').appendChild(el);
> }
> 
> Unfortunately on MSIE this is not so straight forward.

I guess I was just getting lost making it too complicated. Now the 
callback function is like this:

function testCallBack(xho)
{
    if (document.importNode)
    {
       var el = document.importNode(xho.responseXML.documentElement, true);
    }
    else
    {
       var el = document.createElement("div");
       el.innerHTML = xho.responseXML.xml;
       el = el.firstChild;
    }
    document.getElementById('stub').appendChild(el);
}

and everything works nicely.

As usual, when I tell someone about my problem, I right away or soon 
after come up with a solution myself - thanks for listening :-)

.k




More information about the thelist mailing list