I am setting up a GUI server using Flask. I use an API which calls a function whenever a change in a particular Sqlite3 database, I then need to add the changed values to a table on the HTML page.
I have tried learning JQuery but that seems to require a get request coming from the client side. I need all the data that was added or changed in the database on the server-side to be appended to a table on the client page.
<tbody>
{% for data in table_data %}
<tr>
<td>{{ loop.index }}</td>
<td>{{ data[0] }}</td>
<td>{{ data[1] }}</td>
<td>{{ data[2] }}</td>
</tr>
{% endfor %}
</tbody>
def get_data(cursor_obj, table_name, previous_data):
"When called will all the data from the db and will compair it to
the old data and return the data to be appended, which I then need
to add to the table."
cursor_obj.execute("SELECT * FROM "+str(table_name))
data = cursor_obj.fetchall()
for old in previous_data:
index = data.index(old)
data.del(index)
return data