C/S 对接全部换成HTTP协议了。。。
该补课了
1、新建一个http.js脚本
var HttpHelp = {
//获取用户信息
login:function(count,password,callback) {
var url = '你的url格式、协议'
//console.log(url);
var request = new XMLHttpRequest();
console.log("登录:" + url);
request.onreadystatechange = function () {
if (request.readyState == 4 && (request.status >= 200 && request.status < 400)) {
var response = request.responseText;
var rsp = JSON.parse(response).data;
//console.log("Status: login GET response! " + response);
callback(true, rsp);
}else{
callback(false, rsp);
}
};
request.open("GET", url, true);
request.send();
},
}
module.exports = HttpHelp
url解释: