Quantcast
Channel: Cocos中文社区 - 最新帖子
Viewing all articles
Browse latest Browse all 495283

XMLHttpRequest在什么地方添加正在加载(loading)的提示?为什么xhr.onreadystatechange 这个方法一进来readyState 的值就是4,而且只执行一次,添加0-3状态的条件都不执行~!那正在加载的提示应该放在哪里写??

$
0
0

类似这样
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState == 4&&xmlhttp.status == 200&&!!obj.success){
obj.loading.getComponent("DialogAction").hide();
}
if(xmlhttp.readyState == 4&&xmlhttp.status != 200&&!!obj.error){
obj.loading.getComponent("DialogAction").hide();
}
};
if(type=='POST'){
xmlhttp.open(type, obj.url, obj.async||true);
xmlhttp.send(_params(obj.data||null));
obj.loading.getComponent("DialogAction").show();
}else if(type=='GET'){
xmlhttp.open(type, obj.url+'?'+_params(obj.data||null), obj.async||true);
xmlhttp.send(null);
obj.loading.getComponent("DialogAction").show();
}


Viewing all articles
Browse latest Browse all 495283

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>