Commit b2c24bd5 by dabai

xx

parent e3a8db78
Showing with 10 additions and 2 deletions
......@@ -53,14 +53,22 @@ function $ajax(opt) {
}
xmlHttp.onreadystatechange = function() {
var res;
if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
res = xmlHttp.responseText;
if(this.readyState != 4)return;
if( this.status == 200 || this.status == 304) {
res = this.responseText;
if(opt.dataType == 'json') {
res = JSON.parse(res);
}
resolve(res);
} else {
reject(new Error(this.statusText));
}
};
xmlHttp.onerror = function() {
reject(new Error(this.statusText));
};
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment