mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(load) rm xhr.responseText overwriting
This commit is contained in:
parent
652e443106
commit
c095bc9a2e
1 changed files with 5 additions and 12 deletions
|
|
@ -195,14 +195,17 @@ var Util, DOM;
|
|||
|
||||
Events.add('readystatechange', xhr, function(event) {
|
||||
var TYPE_JSON, type, data, isContain, notText,
|
||||
xhr = event.target;
|
||||
xhr = event.target,
|
||||
OK = 200;
|
||||
|
||||
if (xhr.readyState === 4 /* Complete */) {
|
||||
Images.clearProgress();
|
||||
TYPE_JSON = 'application/json';
|
||||
type = xhr.getResponseHeader('content-type');
|
||||
|
||||
if (xhr.status === 200 /* OK */) {
|
||||
if (xhr.status !== OK ) {
|
||||
Util.exec(p.error, xhr);
|
||||
} else {
|
||||
data = xhr.response;
|
||||
notText = p.dataType !== 'text',
|
||||
isContain = ~type.indexOf(TYPE_JSON);
|
||||
|
|
@ -212,16 +215,6 @@ var Util, DOM;
|
|||
|
||||
Util.exec(p.success, data, xhr.statusText, xhr);
|
||||
}
|
||||
/* file not found or connection lost */
|
||||
else {
|
||||
/* if html given or something like thet
|
||||
* getBack just status of result
|
||||
*/
|
||||
if (type && type.indexOf('text/plain') !== 0)
|
||||
xhr.responseText = xhr.statusText;
|
||||
|
||||
Util.exec(p.error, xhr);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue