Hey all. I got a flask application with a form and if you submit the form it's doing some processing. So I want to show the user the status of it by passing the status from flask over JSON to my HTML-Template. It works on my local machine and the text in the Button at the end of the form will start changing once you clicked on it. But it does not work here. Link: https://vatrox.pythonanywhere.com/
The corresponding of my Flask app:
@app.route('/_stuff', methods=['GET'])
def stuff():
return jsonify(result=status_list[-1])
Script in my index.html:
var intervalID = setInterval(update_values, 1000);
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
function update_values() {
$.getJSON($SCRIPT_ROOT + '/_stuff',
function(data) {
$('#status').text(data.result);
if ($('#status').text() !== 'Make Magic') {
$('#status').addClass('passive');
console.log($('#status').text())
}
});
};
I can see all the requests in the access.log but the value isn't changing in my HTML. As I said, I tried this with the exact same code on my local machine and it worked. So I was curious if this is just a pythonanywhere-thing. Thanks in advance!