www/js/rec_edit.js

changeset 489
18e5cfe5d126
parent 474
7b7df475e67d
child 524
55a246085522
--- a/www/js/rec_edit.js	Fri Sep 13 20:24:31 2019 +0200
+++ b/www/js/rec_edit.js	Fri Sep 13 20:48:35 2019 +0200
@@ -2664,7 +2664,7 @@
   }
  });
 
- function saveRecord() {
+ function saveRecord(goback) {
   var row = {
    record: my_record,
    uuid: dataRecord.uuid,
@@ -2765,10 +2765,14 @@
    data: data,
    type: 'POST',
    success: function(data, status, xhr) {
-    console.log('saveRecord() success');
+    console.log('saveRecord(' + goback + ') success');
+    if (goback)
+     window.location.href = my_return;
+    else
+     window.location.href = 'rec_export.php?record=' + my_record + '&return=' + my_return + '&name=' + dataRecord.name;
    },
    error: function(jqXHR, textStatus, errorThrown) {
-    console.log('saveRecord() error');
+    console.log('saveRecord() ' + textStatus);
    }
   });
  };
@@ -3955,8 +3959,7 @@
  // Buttons below
  $('#Export').jqxButton({ template: 'info', width: '80px', theme: theme });
  $('#Export').bind('click', function() {
-  saveRecord();
-  window.location.href = 'rec_export.php?record=' + my_record + '&return=' + my_return + '&name=' + dataRecord.name;
+  saveRecord(0);
  });
 
  $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme });
@@ -3988,8 +3991,7 @@
 
  $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
  $('#Save').bind('click', function() {
-  saveRecord();
-  window.location.href = my_return;
+  saveRecord(1);
  });
  createDelElements();
 });

mercurial