]> git.gag.com Git - fw/quantimotor/commitdiff
slowly figuring out ajax
authorBdale Garbee <bdale@gag.com>
Wed, 7 May 2025 20:24:33 +0000 (14:24 -0600)
committerBdale Garbee <bdale@gag.com>
Wed, 7 May 2025 20:24:33 +0000 (14:24 -0600)
application/app.py
application/index.html

index 628ccb825a28e76bbb07eaf1913ef968c150a263..ea64590afbf334c9285c003642ceb5e44a09b3a6 100755 (executable)
@@ -65,9 +65,13 @@ class App:
   @cherrypy.expose
   @cherrypy.tools.json_out()
   def getData(self):
+    a = 'a few'
+    b = ' psi'
+    n = 42
+    c = str(n) + b
     return {
-      'foo' : 'bar',
-      'baz' : 'another one'
+      'pressure' : c,
+      'thrust' : 'more N'
     }
 
 
index c136d6c17570d0533bb42754b9451677d976f0ac..31bb46f9df6de5b9acb2524ad3f62a85e1cf6ed4 100644 (file)
@@ -12,8 +12,8 @@
       var request = $.ajax({'url': '/getData'});
       request.done(function(response) 
       {
-        $('#foo').text(response.foo);
-        $('#baz').text(response.baz);
+        $('#pressure').text(response.pressure);
+        $('#thrust').text(response.thrust);
       });
       request.fail(function(jqXHR, textStatus) 
       {
@@ -25,9 +25,9 @@
 </head>
 <body>
   <button>make ajax call</button>
-  <h1>Foo</h1>
-  <div id='foo'></div>
-  <h1>Baz</h1>
-  <div id='baz'></div>
+  <h1>Pressure</h1>
+  <div id='pressure'></div>
+  <h1>Thrust</h1>
+  <div id='thrust'></div>
 </body>
 </html>