From b1c701c17815f54e4bf0b8e6ff845d37fd0a4709 Mon Sep 17 00:00:00 2001 From: LV-426 Date: Mon, 23 Feb 2015 14:44:41 +0200 Subject: util.js: form_common__rest_post() --- src/client/util.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/client') diff --git a/src/client/util.js b/src/client/util.js index 3fd4aecb..a041c813 100644 --- a/src/client/util.js +++ b/src/client/util.js @@ -1,6 +1,6 @@ "use strict" -define(function() { +define(['jquery'], function($) { function assert(condition, message) { if (false == condition) { @@ -61,6 +61,19 @@ define(function() { return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } + function form_common__rest_post(rest_path, data, success, error) { + $.ajax({ type : "POST", + url : rest_path, + async : false, + cache : false, + data : JSON.stringify(data), + dataType : 'json', + contentType : "application/json; charset=utf-8", + success : success, + error: error + }); + } + return { assert: assert, set_from_array: set_from_array, @@ -68,5 +81,6 @@ define(function() { set_diff: set_diff, array_diff: array_diff, getParameterByName: getParameterByName, + form_common__rest_post: form_common__rest_post, }; }); -- cgit v1.3.1