diff options
| author | LV-426 <lv-426@taproot.org.il> | 2015-02-23 14:44:41 +0200 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2015-02-23 15:07:53 +0200 |
| commit | b1c701c17815f54e4bf0b8e6ff845d37fd0a4709 (patch) | |
| tree | de1a45aeab81415865f88341eef6e2e1c3152318 /src/client | |
| parent | b41bbb6dba5a0cf7e6d20d7edf8d0ce25af78623 (diff) | |
util.js: form_common__rest_post()
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/util.js | 16 |
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, }; }); |
