Check error code when no completion function is defined as well
[misc/kostenrechnung] / lib / functions.js
index 8554e2b..e4c6e50 100644 (file)
@@ -24,10 +24,9 @@ function ajax_request(func,params,oncomplete)
     req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
     req.setRequestHeader("Content-length", params.length);
     req.setRequestHeader("Connection", "close");
-    if (typeof oncomplete == 'function') {
-       req.onreadystatechange = function() { ajax_request_callback(req); }
+    req.onreadystatechange = function() { ajax_request_callback(req); }
+    if (typeof oncomplete == 'function')
        req.oncomplete = oncomplete;
-    }
     req.send(params);
 }