www/js/profile_fermentation.js

changeset 768
ae1195153fa2
parent 702
f0896a6f9b64
--- a/www/js/profile_fermentation.js	Sun Jul 04 14:25:52 2021 +0200
+++ b/www/js/profile_fermentation.js	Sun Jul 04 20:01:13 2021 +0200
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2019-2020
+ * Copyright (C) 2019-2021
  *
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -75,8 +75,13 @@
     cache: false,
     data: data,
     type: 'POST',
-    success: function(data, status, xhr) {
-     commit(true);
+    success: function(data) {
+     if (data.error) {
+      console.log('delete: ' + data.msg);
+      alert('Fout: ' + data.msg);
+     } else {
+      console.log('delete: success');
+     }
      location.reload(true);
     },
     error: function(jqXHR, textStatus, errorThrown) { commit(false); }
@@ -90,8 +95,13 @@
     cache: false,
     data: data,
     type: 'POST',
-    success: function(data, status, xhr) {
-     commit(true);
+    success: function(data) {
+     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); }
@@ -105,8 +115,13 @@
     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');
+     }
      location.reload(true);
     },
     error: function(jqXHR, textStatus, errorThrown) { commit(false); }

mercurial