feature(load) rm xhr.responseText overwriting

This commit is contained in:
coderaiser 2014-11-06 10:39:58 -05:00
parent 652e443106
commit c095bc9a2e

View file

@ -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);
}
}
});