mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-25 17:04:16 +00:00
refactor(dom) Loader ajax: add TYPE_JSON
This commit is contained in:
parent
02b10d68c6
commit
aba5107ac0
1 changed files with 4 additions and 3 deletions
|
|
@ -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) )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue