summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2015-02-23 14:44:41 +0200
committerLV-426 <lv-426@taproot.org.il>2015-02-23 15:07:53 +0200
commitb1c701c17815f54e4bf0b8e6ff845d37fd0a4709 (patch)
treede1a45aeab81415865f88341eef6e2e1c3152318
parentb41bbb6dba5a0cf7e6d20d7edf8d0ce25af78623 (diff)
util.js: form_common__rest_post()
-rw-r--r--src/client/util.js16
1 files changed, 15 insertions, 1 deletions
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,
};
});