Test webserver with minimalist JavaScript
[matches/MCTX3420.git] / testing / web2io / test.js
diff --git a/testing/web2io/test.js b/testing/web2io/test.js
new file mode 100644 (file)
index 0000000..4fb8933
--- /dev/null
@@ -0,0 +1,14 @@
+$(document).ready(function()
+{
+       // Send AJAX request
+       $.ajax({url : "/sensor", data : {}}).done(function(data) {$(this).update(data)});
+
+       // Interpret AJAX response
+       $.fn.update = function(data)
+       {
+               console.log("Interpret AJAX response: "+data);
+               $("#body").html("<a href=\"/index.html\">"+data+"</a>")
+       }
+       
+});
+

UCC git Repository :: git.ucc.asn.au