From what it seems like, after calling a Jinja function, the return value is "set in stone" and cannot be changed, however, I need a way to call a Jinja function and get its current return value continuously. Currently I have the following code:
app.py [SNIPPET]
def statusupdate():
return status
app.jinja_env.globals.update(statusupdate=statusupdate)
index.html [SNIPPET]
<script>
function stat(){
if ("{{ statusupdate() }}" == "Done"){
clearInterval(id)
window.location.href = '/results'
} else {
document.getElementById("status").innerHTML = "{{ statusupdate() }}"
}
}
id = setInterval(stat, 0)
</script>
Throughout app.py
, the status
variable is changing quite a bit. However, the page and specifically the element with id "status" is frozen at the initial value and is never updated. Is there a way to allow this to update?