I want to display the Port status dynamically. I don't want to reload the page to see a new value. I know how to get the Port status in Python(using uiApi()
). Right now I render a template with the value and show the values in HTML table. How can I continually update the table with a value from Flask? I have the AJAX and jquery available.
The Flask Code is give below:
@app.route('/')
def show_auth():
tData = uiApi()
..
return render_template('show_auth.html', tMain=tData)
The {{field}} in The HTML file 'show_auth.html' below should be dynamically updated:
<form action="{{ url_for('submit_token') }}" method=post>
<div id="Main" class="tabcontent" style="display:block" >
<div class="PanelWrapper" >
<div class="pageTitle">WAN</div>
<div class="layout">
<div class="col">
<table frame="void" rules="none">
<tbody>
{%for key, field in tMain.items() %}
<tr>
<td class="attrLabel" valign="middle" nowrap>{{key}}</td>
<td class="attrLabel" valign="middle">: </td>
<td>{{field}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
...
....