Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I am having xml in a site www.xyz.com/files/abc.html

i developed other site in that site i have to read the xml file


i am using this code not working .

JavaScript
<script type="text/javascript">
        var XmlHttp = null;
        if (window.XMLHttpRequest) {
            XmlHttp = new XMLHttpRequest();
            alert(1);
        }
        else // Internet Explorer 5/6
        {   alert(2);
            XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        alert(3);
        XmlHttp.open("GET", "http://www.xyz.com/ab/books.xml", true);
        XmlHttp.send("");
        var xmlDoc = XmlHttp.responseXML;
       
        alert(1234);
    </script>   


Regards
Posted
Updated 22-May-10 9:37am
v2

1 solution

Reading any content from another site is a security risk and will be blocked by browsers.
To do this, you should return not XML but JSONP format:

http://www.ibm.com/developerworks/library/wa-aj-jsonp1/
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900