情景是:断线了,网络又好了 再向服务器重新发送同一个GET 的请求。
var xhr = cc.loader.getXMLHttpRequest();
xhr.open(“GET”, HOST+"/users/"+user_id+"/sss");
xhr.setRequestHeader(“Authorization”,token);
xhr.setRequestHeader(“Content-Type”,“application/json”);
var sendData = “****”,
xhr.send(sendData);
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 && (xhr.status>=200 && xhr.status<207)){
var httpStatus = xhr.statusText;
callback(xhr.responseText);
}else{
//重新请求?? 怎么做
};