From aba5107ac0d37b6cca3f14d86562f31c36dcb4ed Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 19 Sep 2013 13:38:51 +0000 Subject: [PATCH] refactor(dom) Loader ajax: add TYPE_JSON --- lib/client/dom.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index f410f964..ccbf7d4e 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -687,14 +687,15 @@ var CloudCmd, Util, DOM, CloudFunc; Events.add('readystatechange', function(pEvent) { if (xhr.readyState === 4 /* Complete */) { - var lJqXHR = pEvent.target, - lType = xhr.getResponseHeader('content-type'); + var lJqXHR = pEvent.target, + TYPE_JSON = 'application/json', + lType = xhr.getResponseHeader('content-type'); if (xhr.status === 200 /* OK */) { var lData = lJqXHR.response; /* If it's json - parse it as json */ - if (lType && Util.isContainStr(lType, 'application/json') ) + if (lType && Util.isContainStr(lType, TYPE_JSON) ) lData = Util.parseJSON(lJqXHR.response) || lJqXHR.response; if ( Util.isFunction(p.success) )