document.addEventListener('plusready', function(){
var xhr = new plus.net.XMLHttpRequest();
xhr.onload = function () {
switch ( xhr.readyState ) {
case 0:
alert( "xhr请求已初始化" );
break;
case 1:
alert( "xhr请求已打开" );
break;
case 2:
alert( "xhr请求已发送" );
break;
case 3:
alert( "xhr请求已响应");
break;
case 4:
if ( xhr.status == 200 ) {
alert( "xhr请求成功:"+xhr.responseText );
} else {
alert( "xhr请求失败:"+xhr.readyState );
}
break;
default :
break;
}
}
xhr.open( "GET", net_url('test/index') );
xhr.send(null);
}, false );
WiFi环境下status为200,readyState为4,正常返回内容
4G环境下status为0,readyState为4,没有返回内容
安卓的话都正常,就苹果端出现这个问题,能解决不
0 个回复