javascript : add function to concat 2 json objects
This commit is contained in:
parent
d67485d417
commit
18bf9951e7
2 changed files with 24 additions and 2 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -3665,3 +3665,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;
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue