creator网络请求不了 使用XMLHttpRequest会报错

用官方的XMLHttpRequest例子,打开会报错。


代码如下:
var url = "http://www.bejson.com/test/userinfop.php"; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) { var response = xhr.responseText; console.log(response); } }; xhr.open("GET", url, true); xhr.send();

有人能指点一下在cocos creator里,怎么用http请求内容数据的吗?

跨域了,请求不了

在creator里一般是怎么请求数据的啊?现在是取不到数据,怎么解决呢。