On my HTML page I've got a span that gets the value of the function getStatus():
<span id="sysStatus" style="font-weight: bold;">{{ status }}</span>
The function that returns status:
def getStatus(): state = database().getState() if state: status = " On" else: status = "Off" return status
Rendering the html page:
class Tongles(flask.views.MethodView): def get(self): return flask.render_template('page.html', status=getStatus())
I would like somehow to dynamically refresh the status of the system, and the text on the span.
How can I recall the function getStatus without reloading the whole page?