现在url用的ip端口号,访问图片或者json的话,总是报错。
Error: Download text failed:…
creator模拟器方式。
现在url用的ip端口号,访问图片或者json的话,总是报错。
Error: Download text failed:…
creator模拟器方式。
ip端口号方式链接,在浏览器中直接输入打开可以获取到结果,模拟器中就报错
有朋友遇到过类似的问题么
var statusUrl=’****’;
cc.loader.load(statusUrl,function (err, json) {
console.log(‘err status:’,err);
console.log(‘json status:’,json);
});
url换成域名的也不可以。
这个方法在有什么问题么?@jare
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) {
var response = xhr.responseText;
console.log(’#########response:’,response);
}
};
xhr.open(“GET”, url, true);
xhr.send();
改用这种方式,可以拿到服务器端的数据了。
模拟器方式运行。