summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/static/js/app.js')
-rw-r--r--module/web/static/js/app.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/module/web/static/js/app.js b/module/web/static/js/app.js
index 59ad04fc9..53af4b797 100644
--- a/module/web/static/js/app.js
+++ b/module/web/static/js/app.js
@@ -28,10 +28,21 @@ define([
// Add Global Helper functions
_.extend(Application.prototype, Backbone.Events, {
- apiCall: function(method, args, options) {
+ // Generates options dict that can be used for xhr requests
+ apiRequest: function(method, data, options) {
options || (options = {});
-
-
+ options.url = window.pathPrefix + "/api/" + method;
+ options.dataType = "json";
+ if (data) {
+ options.type = "POST";
+ options.data = {};
+ // Convert arguments to json
+ _.keys(data).map(function(key) {
+ options.data[key] = JSON.stringify(data[key]);
+ });
+ }
+
+ return options;
},
openWebSocket: function(path) {