mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-29 02:30:28 +00:00
added ability to parse 404 status code on ajax
This commit is contained in:
parent
c137f9a28c
commit
b1a02ba767
1 changed files with 11 additions and 4 deletions
13
client.js
13
client.js
|
|
@ -153,9 +153,10 @@ CloudClient.Utils = (function(){
|
||||||
console.log('error in Util.ajax onSuccess:', pParams);
|
console.log('error in Util.ajax onSuccess:', pParams);
|
||||||
|
|
||||||
lXMLHTTP.onreadystatechange = function(pEvent){
|
lXMLHTTP.onreadystatechange = function(pEvent){
|
||||||
if (lXMLHTTP.readyState === 4 /* Complete */ &&
|
var lJqXHR = pEvent.target;
|
||||||
lXMLHTTP.status === 200 /* OK */){
|
if (lXMLHTTP.readyState === 4 /* Complete */){
|
||||||
var lJqXHR = pEvent.target;
|
|
||||||
|
if (lXMLHTTP.status === 200 /* OK */){
|
||||||
var lData = lJqXHR.response;
|
var lData = lJqXHR.response;
|
||||||
|
|
||||||
/* If it's json - parse it as json */
|
/* If it's json - parse it as json */
|
||||||
|
|
@ -177,6 +178,12 @@ CloudClient.Utils = (function(){
|
||||||
|
|
||||||
lSuccess_f(lData, lJqXHR.statusText, lJqXHR);
|
lSuccess_f(lData, lJqXHR.statusText, lJqXHR);
|
||||||
}
|
}
|
||||||
|
else if(lXMLHTTP.status === 404 /* file not found */){
|
||||||
|
var lError_f = pParams.error;
|
||||||
|
if(typeof lError_f === 'function')
|
||||||
|
lError_f(lJqXHR);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else $.ajax(pParams);
|
else $.ajax(pParams);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue