Stop the form from doing a full-page reload. Instead, use fetch() to send the data to the server in the background. In Flask When it gets background request, it updates the database and just replies with a piece of JSON, like: return jsonify({'status': 'success', 'animal': 'Lion'}). It doesn't render_template again.