tags:

views:

2168

answers:

3

I am getting this Error

NETWORK_ERROR: XMLHttpRequest Exception 101

when trying to get XML content from one site. Here is my code

var xmlhttp; 
if(window.XMLHttpRequest)
        { 
            xmlhttp = new XMLHttpRequest();
        }
         if (xmlhttp==null)
        {
            alert ("Your browser does not support XMLHTTP!");
            return;
        }         

xmlhttp.onReadyStateChange=function() 
        {
                if(xmlhttp.readyState==4)
                {
                var value =xmlhttp.responseXML;
                alert(value);
                }
         } 
        xmlhttp.open("GET",url,false);
        xmlhttp.send();
        //alert(xmlhttp.responseXML);      
     }
xmlhttp.open("GET",url,false);
xmlhttp.send(null);

Does any one have a solution?

+1  A: 

My solution is to not write your own code for Ajax requests. There are many good libraries out there which will be perfectly able to handle this stuff for you, which will save you alot of time and headaches.
tip: use jQuery

Jasper De Bruijn
A: 

Something like this happened with me when I returned incorrect XML (I put an attribute in the root node). In case this helps anyone.

Mart van de Sanden
+3  A: 

If the url you provide is located externally to your server, you have permission problems. You cannot access data from another server with a XMLHttpRequest.

This post has some solutions for you to try out.

If this is your problem also see this related question

Google has lots of information on this too.

Frederik Wordenskjold