cocos2djs httppost同步 安卓的readyState一直为1

代码如下:
var httpPostansyc = function (url, data, ajaxSuccess, ajaxError,header) {
var result1 = null;
data = _.isString(data) ? data : JSON.stringify(data);
var xhr = cc.loader.getXMLHttpRequest();
xhr.open(“POST”, url,false);
xhr.setRequestHeader(“Content-Type”, “application/x-www-form-urlencoded”);
if(header) {
for(var i = 0;i<header.length;i++) {
xhr.setRequestHeader(header[i][0], header[i][1]);
console.log(header[i][0]+’:’+header[i][1]);
}
}
xhr.onerror = function () {
ajaxError(xhr.statusText || null);
};
xhr.send(data);
console.log(‘status’ + xhr.status);
console.log(‘readyState’ + xhr.readyState);
console.log(xhr.responseText+’’);
result1 = ajaxSuccess(xhr.responseText);
return result1;
};
在浏览器可以正常使用 打包到安卓上 就获取不到xhr.responseText,抓包也看到了收到了http的返回 但是输出的readyState 为1 xhr.status 为0,求大神帮个忙啊 折磨死人了

又大神么 或者是cocos的工作人员 求帮忙

你xhr的用法有问题
http://www.cocos.com/docs/creator/scripting/network.html

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();

主要到底是怎么处理什么时候处理返回消息的

我的事同步的请求啊 不用实现onreadystatechange方法吧

安卓打印如下:
4-29 12:20:09.939 32226-32310/com.xygame.qipai D/cocos2d-x debug info: sign:{“ticket”:“309ca0c403648e5500ff01277cd62b34”,“id”:“3000”,“time”:1493439610}
04-29 12:20:09.939 32226-32310/com.xygame.qipai D/cocos2d-x debug info: status0
04-29 12:20:09.939 32226-32310/com.xygame.qipai D/cocos2d-x debug info: readyState1
04-29 12:20:09.939 32226-32310/com.xygame.qipai D/cocos2d-x debug info: ResponseText was empty, probably there is a network error!
04-29 12:20:09.939 32226-32310/com.xygame.qipai D/cocos2d-x debug info: ResponseText was empty, probably there is a network error!
04-29 12:20:09.939 32226-32310/com.xygame.qipai D/cocos2d-x debug info: success1
04-29 12:20:09.939 32226-32310/com.xygame.qipai D/cocos2d-x debug info: iplist game.damajiangg.com

求大神啊!

解决了吗?我现在get正常,post收不到数据的