www/js/inv_equipments.js

changeset 766
86289b0c4a27
parent 702
f0896a6f9b64
child 767
08c0343b622b
--- a/www/js/inv_equipments.js	Thu Jul 01 13:24:19 2021 +0200
+++ b/www/js/inv_equipments.js	Sun Jul 04 12:16:25 2021 +0200
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2014-2020
+ * Copyright (C) 2014-2021
  *
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -129,7 +129,13 @@
     data: data,
     type: 'POST',
     success: function(data, status, xhr) {
-     commit(true);
+     if (data.error) {
+      console.log('delete: ' + data.msg);
+      alert('Fout: ' + data.msg);
+     } else {
+      console.log('delete: success');
+     }
+     //commit(true);
      location.reload(true);
     },
     error: function(jqXHR, textStatus, errorThrown) { commit(false); }
@@ -144,7 +150,12 @@
     data: data,
     type: 'POST',
     success: function(data, status, xhr) {
-     commit(true);
+     if (data.error) {
+      console.log('insert: ' + data.msg);
+      alert('Fout: ' + data.msg);
+     } else {
+      console.log('insert: success');
+     }
      location.reload(true);
     },
     error: function(jqXHR, textStatus, errorThrown) { commit(false); }
@@ -158,11 +169,17 @@
     cache: false,
     data: data,
     type: 'POST',
-    success: function(data, status, xhr) {
-     commit(true);
+    success: function(data) {
+     if (data.error) {
+      console.log('updaterow: ' + data.msg);
+      alert('Fout: ' + data.msg);
+     } else {
+      console.log('updaterow: success');
+     }
+     //commit(true);
      location.reload(true);
     },
-    error: function(jqXHR, textStatus, errorThrown) { commit(false); }
+    error: function(jqXHR, textStatus, errorThrown) { console.log('updaterow: ' + textStatus); commit(false); }
    });
   }
  },

mercurial