X-Git-Url: https://hackdaworld.org/gitweb/?p=outofuni%2Fjsutils.git;a=blobdiff_plain;f=xhr.js;h=b97ec03dac0ca276b84f1caa89ce9ad7106bcf96;hp=f666ad2adf7d86fca56ee30fb566ae943a46dedb;hb=429ea8a1e82c21e24e15f54f6df35a08882cf17b;hpb=6e422299e58210a31d3b080f935a8213f9eef68c diff --git a/xhr.js b/xhr.js index f666ad2..b97ec03 100644 --- a/xhr.js +++ b/xhr.js @@ -5,7 +5,7 @@ * */ -function xhr(type,url,data,cb) { +function xhr(type,url,data,cb,cberr) { var ao={ url: url, type: type, @@ -13,6 +13,11 @@ function xhr(type,url,data,cb) { cb(ret); } }; + if(cberr!==undefined) { + ao.error=function(xhr,stat,err) { + cberr(xhr,stat,err); + }; + }; if((data!==undefined)&&(data!==null)) { if(typeof data != "string") ao.data=JSON.stringify(data);