gearman -> jsonp -> angular
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 11 Mar 2011 20:32:57 +0000 (20:32 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 11 Mar 2011 20:32:57 +0000 (20:32 +0000)
public/ping.html [new file with mode: 0644]

diff --git a/public/ping.html b/public/ping.html
new file mode 100644 (file)
index 0000000..1297cb0
--- /dev/null
@@ -0,0 +1,35 @@
+<!doctype html>
+<html xmlns:ng="http://angularjs.org">
+ <script src="http://code.angularjs.org/angular-0.9.12.min.js" ng:autobind></script>
+ <body>
+  <script>
+    function PingCntl($xhr) {
+      var self = this;
+   
+      this.fetch = function() {
+        self.clear();
+       self.url = '/g/' + self.function + '/' + self.args + '?callback=JSON_CALLBACK';
+        $xhr('JSON', self.url, function(code, response) {
+          self.code = code;
+          self.response = response;
+        });
+      };
+   
+      this.clear = function() {
+        self.code = null;
+        self.response = null;
+      };
+    }
+    PingCntl.$inject = ['$xhr'];
+  </script>
+  <div ng:controller="PingCntl">
+    <input type="text" name="function" value="ping"      size="20"/><br/>
+    <input type="text" name="args"     value="localhost" size="10"/><br/>
+    <tt>{{url}}</tt>
+    <button ng:click="fetch()">fetch</button>
+    <button ng:click="clear()">clear</button>
+    <pre>code={{code}}</pre>
+    <pre>response={{response}}</pre>
+  </div>
+ </body>
+</html>