From 9497fcede83db3d05b07bd574e6c30063458eb6a Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Wed, 7 May 2025 14:24:33 -0600 Subject: [PATCH] slowly figuring out ajax --- application/app.py | 8 ++++++-- application/index.html | 12 ++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/application/app.py b/application/app.py index 628ccb8..ea64590 100755 --- a/application/app.py +++ b/application/app.py @@ -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' } diff --git a/application/index.html b/application/index.html index c136d6c..31bb46f 100644 --- a/application/index.html +++ b/application/index.html @@ -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 @@ -

Foo

-
-

Baz

-
+

Pressure

+
+

Thrust

+
-- 2.47.2