noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 36/119: javascript : add function to concat 2


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 36/119: javascript : add function to concat 2 json objects
Date: Mon, 26 Oct 2020 18:27:12 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 0982ee1c4abcca2cb235fef754c966eb93ab637f
Author: Dany De Bontridder <dany@alchimerys.be>
AuthorDate: Sun Sep 27 10:55:59 2020 +0200

    javascript : add function to concat 2 json objects
---
 html/js/managetable.js |  5 +++--
 html/js/scripts.js     | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/html/js/managetable.js b/html/js/managetable.js
index d67e774..3d5d15f 100644
--- a/html/js/managetable.js
+++ b/html/js/managetable.js
@@ -189,18 +189,19 @@ var ManageTable = function (p_table_name)
      * set
      */
     this.save = function (form_id) {
+        var param_form={};
         waiting_box();
         try {
             this.param['action'] = 'save';
             var form = $(form_id).serialize(true);
-            this.param_add(form);
+            param_form = json_concat(this.param,form);
             var here=this; 
           } catch (e) {
             alert(e.message);
             return false;
           }
         new Ajax.Request(this.callback, {
-            parameters: this.param,
+            parameters: param_form,
             method: "post",
             onSuccess: function (req) {
                 try {
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 959788c..4451f83 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -3673,3 +3673,24 @@ function toggle_row_warning_enable(p_enable, p_row)
         $(p_row).hide();
     }
 }
+
+/**
+ * return a json object which is the merge of the 2 json objects
+ *
+ * @param p_json1 object 1 to merge
+ * @param p_json2 object 2 to merge
+ * @returns new json object
+ */
+function json_concat(p_json1,p_json2)
+{
+
+        var result = {};
+        for (var key in p_json1) {
+            result[key] = p_json1[key];
+        }
+        for (var key in p_json2) {
+            result[key] = p_json2[key];
+        }
+        return result;
+
+}
\ No newline at end of file



reply via email to

[Prev in Thread] Current Thread [Next in Thread]