xmlhttprequest无法获取网络资源,为什么?

    var url = 'http://www.baidu.com';
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function ()
    {
        cc.log("readyState:"+xhr.readyState+" status:"+xhr.status);
        if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400))
        {
            var response = xhr.responseText;
            cc.log(response);
        }
    };
    xhr.open("GET", url, true);
    xhr.send();

无论网址是什么,始终是 readyState:4 status:0
这是为什么呢?

已经解决,是跨域访问的问题,服务器设置必须增加允许跨域访问的设置,就可以了。