]> git.pond.sub.org Git - eow/blobdiff - static/eow.js
add basic Ajax test
[eow] / static / eow.js
diff --git a/static/eow.js b/static/eow.js
new file mode 100644 (file)
index 0000000..f856075
--- /dev/null
@@ -0,0 +1,29 @@
+function eowOut(output) {
+  var t = document.createTextNode(output);
+  var p = document.createElement("p");
+  p.appendChild(t);
+  dojo.byId("output").appendChild(p);
+}
+
+function hello() {
+  dojo.xhrGet( {
+    // The following URL must match that used to test the server.
+    url: "/eow/static/ajax.txt", 
+    handleAs: "javascript",
+
+    timeout: 5000, // Time in milliseconds
+
+    // The LOAD function will be called on a successful response.
+    load: function(response, ioArgs) {
+      console.log(response);
+      return response;
+    },
+
+    // The ERROR function will be called in an error case.
+    error: function(response, ioArgs) {
+      console.error("HTTP status code: ", ioArgs.xhr.status);
+      return response;
+    }
+  });
+}
+