请问哪位大侠知道cocos-js数据通信的方式,给段能用的代码可否?
大侠,帮忙看看我这段代码有什么问题?我照着你那地址的方法写了,但xhr.readyState一直=1,无法获取到 xhr.responseText。谢谢
var response="";
var xhr = cc.loader.getXMLHttpRequest();
xhr.open(“POST”,“http://192.168.1.199/test.aspx?type=cc”);//这个地址访问返回:ABC
xhr.setRequestHeader(“Content-Type”, “application/x-www-form-urlencoded”);
xhr.onreadystatechange = function () {
if(xhr.readyState == 4){
response = xhr.responseText;
}else if(xhr.readyState == 4){
response = xhr.responseText;
}
};
xhr.send();
用firefox或者谷歌浏览器 打开开发者工具 看看有没有报错日志