-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8">
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
- <title>FastCGI API Test</title>
- <style>
- body {
- font-family: "Trebuchet MS", "Verdana", "Arial", "Sans";
- font-size: 12px;
- margin: 1em;
- }
- h2 {
- border-bottom: 1px solid gray;
- }
- .io {
- border: 1px solid gray;
- padding: 0.5em;
- margin: 1em;
- min-height: 5em;
- background-color: GhostWhite;
- }
- </style>
-
- <script>
- $(document).ready(function()
- {
- $('#inputquery').submit(function ()
- {
- $('#output').text("Submitting query...");
- var query = $('#inputquery').find('input[name="query"]').val();
-
- var d = new Date();
- var start = d.getMilliseconds();
- var domain = document.domain == "mctx.us.to" ? "mctx.us.to:8080" : document.domain;
- $.getJSON('http://'+domain+'/api/'+query, function(data) {
- var items = [];
- var timeDiff = d.getMilliseconds() - start; //Not precise at all, use web console
-
- $.each(data, function(key, val) {
- items.push('<li>"' + key + '" : "' + val + '"</li>');
- });
-
-
- $('#output').html("Response ok (" + timeDiff + "ms)! Output:<br>");
- $('<ul/>', {
- html: items.join("\n")
- }).appendTo('#output');
-
- }).fail(function(jqXHR) {
- $('#output').text("Query failed with response code: " + jqXHR.status);
- });
- return false;
- });
- });
- </script>
- </head>
-
- <body>
- <h1>FastCGI API Test</h1>
- The API is located at: <a href="http://mctx.us.to:8080/api/">http://mctx.us.to:8080/api/</a><br>
- <h2>Input</h2>
- Place a query string here. Examples include:<br>
- <ul>
- <li><pre>sensors?key=value&key2</pre></li>
- <li><pre>doesntexist?f</pre></li>
- </ul>
- Response times are inaccurate via JavaScript. Use the web console of
- your browser to determine how long the query takes.<br>
- Hopefully this doesn't break!
- <div class="io">
- <form id="inputquery" name="input" action="#">
- Query string: <input type="text" name="query"><br>
- <input type="submit" value="Submit">
- </form>
- </div>
-
- <h2>Output</h2>
- <div id="output" class="io">
- </div>
- </body>
-</html>