aboutsummaryrefslogtreecommitdiff
path: root/src/js/chrome/js/platform-ajax.js
diff options
context:
space:
mode:
authorGravatar Trevor Elliott <trevor@galois.com>2013-06-07 11:59:57 -0700
committerGravatar Trevor Elliott <trevor@galois.com>2013-06-07 11:59:57 -0700
commit8690d56ff0bbd1031e8cc6788dd2159aac6b7adb (patch)
treed573336305dc756f357f20dd986f77cb3ceafb9b /src/js/chrome/js/platform-ajax.js
parentf42930c2226d07482725b03ad522c106c0bdec8b (diff)
Reorganize the build system
* Move all javascript source to src/js * Update the test runner, etc. * Do less javascript compilation
Diffstat (limited to 'src/js/chrome/js/platform-ajax.js')
-rw-r--r--src/js/chrome/js/platform-ajax.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/js/chrome/js/platform-ajax.js b/src/js/chrome/js/platform-ajax.js
new file mode 100644
index 0000000..68ced39
--- /dev/null
+++ b/src/js/chrome/js/platform-ajax.js
@@ -0,0 +1,39 @@
+
+
+var fiveui = fiveui || {};
+
+(function() {
+
+fiveui.ajax = fiveui.ajax || {};
+
+/**
+ * Use jQuery to get the resource, calling the success or error continuations
+ * when the result is returned. This always retrieves as text, leaving any
+ * further processing to the success continuation.
+ */
+fiveui.ajax.get = function(url, options) {
+
+ _.defaults(options, {
+ success:function() {},
+ error: function() {}
+ });
+
+ jQuery.ajax(url, {
+
+ dataType: 'text',
+
+ success:function(text) {
+ // strip out everything else from the args
+ options.success(text);
+ },
+
+ error:function() {
+ // call with no context
+ options.error();
+ },
+
+ });
+
+};
+
+})();