projects
/
outofuni
/
jsutils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added optional error callback
[outofuni/jsutils.git]
/
xhr.js
diff --git
a/xhr.js
b/xhr.js
index
f666ad2
..
b97ec03
100644
(file)
--- 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,
var ao={
url: url,
type: type,
@@
-13,6
+13,11
@@
function xhr(type,url,data,cb) {
cb(ret);
}
};
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);
if((data!==undefined)&&(data!==null)) {
if(typeof data != "string")
ao.data=JSON.stringify(data);