I try to receive XML sample from w3schools.com (http://www.w3schools.com/XML/cd_catalog.xml) but get nothing (xmlhttp.status=0).
My local web server is Apache on VMWare (host OS Win7, Guest OS Ubuntu, Network adapter - NAT).
Here is the code:
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","http://www.w3schools.com/XML/cd_catalog.xml", true);
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
alert("status " + xmlhttp.status);
}
xmlhttp.send();
It alerts "status 0".
I can open http://www.w3schools.com/XML/cd_catalog.xml in the browser (on virtual machine).
With the local XML file (cd_catalog.xml saved as a local file in the same directory as the script above) everything works OK.
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","cd_catalog.xml", true);
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
alert("status " + xmlhttp.status);
}
xmlhttp.send();
It alerts "status 200".
What can cause the problem (xmlhttp.status=0) with online request?