web/data/cubicweb.ajax.js
changeset 6565 e89de028d004
parent 6555 f8b36b1e98bf
parent 6560 48ba5069e051
child 6645 179eb6131e92
--- a/web/data/cubicweb.ajax.js	Wed Oct 20 15:57:35 2010 +0200
+++ b/web/data/cubicweb.ajax.js	Wed Oct 20 15:58:27 2010 +0200
@@ -36,12 +36,10 @@
     },
 
     addCallback: function(callback) {
-        if (this._req.readyState == 4) {
-            if (this._result) {
-                var args = [this._result, this._req];
-                jQuery.merge(args, cw.utils.sliceList(arguments, 1));
-                callback.apply(null, args);
-            }
+        if ((this._req.readyState == 4) && this._result) {
+            var args = [this._result, this._req];
+            jQuery.merge(args, cw.utils.sliceList(arguments, 1));
+            callback.apply(null, args);
         }
         else {
             this._onSuccess.push([callback, cw.utils.sliceList(arguments, 1)]);
@@ -50,10 +48,8 @@
     },
 
     addErrback: function(callback) {
-        if (this._req.readyState == 4) {
-            if (this._error) {
-                callback.apply(null, [this._error, this._req]);
-            }
+        if (this._req.readyState == 4 && this._error) {
+            callback.apply(null, [this._error, this._req]);
         }
         else {
             this._onFailure.push([callback, cw.utils.sliceList(arguments, 1)]);