I'm using setInterval() function to reload information every 5 seconds. The html looks like:
<div id = "update"> </div>
<script>
window.setInterval(
function() {
$("#update").load("/game");
}, 5000);
</script>
In Flask, my views.py:
@app.route('/game')
def live_game():
text = "<p> test </p>"
return text
Now, I'd like to change the variable text every time the page reloads. Something like:
counter = 0
@app.route('/game')
def live_game():
textlist = ['a','b','c','d']
text = "<p> "+textlist[counter]+" </p>"
counter += 1
return text
This obviously doesn't work, as I'm sure I need to be incrementing on the jQuery side, I'm just not sure how. Any help would be appreciated!