From: Moritz Bunkus Date: Fri, 19 Jul 2013 11:55:12 +0000 (+0200) Subject: ClientJS: Daten bei AJAX-Submits als POST-Content schicken, nicht an die URL dran X-Git-Tag: release-3.1.0beta1~120 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=88abef92ceaa2f2f297eb0b2a9a64418bed97ba7;p=kivitendo-erp.git ClientJS: Daten bei AJAX-Submits als POST-Content schicken, nicht an die URL dran --- diff --git a/js/client_js.js b/js/client_js.js index e096d5236..51e3638cd 100644 --- a/js/client_js.js +++ b/js/client_js.js @@ -129,8 +129,15 @@ ns.eval_json_result = function(data) { }; ns.submit_ajax_form = function(url, form_selector, additional_data) { - var separator = /\?/.test(url) ? '&' : '?'; - $.post(url + separator + $(form_selector).serialize(), additional_data, ns.eval_json_result); + var data = $(form_selector).serialize(); + if (additional_data) { + if (data) + data += '&'; + data += typeof additional_data == "string" ? additional_data : $(additional_data).serialize(); + } + + $.post(url, data, ns.eval_json_result); + return true; }; diff --git a/scripts/generate_client_js_actions.tpl b/scripts/generate_client_js_actions.tpl index 6772cd102..b2ab0460c 100644 --- a/scripts/generate_client_js_actions.tpl +++ b/scripts/generate_client_js_actions.tpl @@ -36,8 +36,15 @@ ns.eval_json_result = function(data) { }; ns.submit_ajax_form = function(url, form_selector, additional_data) { - var separator = /\?/.test(url) ? '&' : '?'; - $.post(url + separator + $(form_selector).serialize(), additional_data, ns.eval_json_result); + var data = $(form_selector).serialize(); + if (additional_data) { + if (data) + data += '&'; + data += typeof additional_data == "string" ? additional_data : $(additional_data).serialize(); + } + + $.post(url, data, ns.eval_json_result); + return true; };