如何在不刷新页面的情况下刷新表数据

时间:2020-04-11 11:49:00

标签: flask

我们可以使用python flask来以表格格式显示数据:

<table>
    <thead>
    <tr>
        <th>ID</th>
        <th>Name</th>
        <th>Email</th>
        <th>Phone</th>
    </tr>
    </thead>
    <tbody>
        {% for row in output_data %}
            <tr>
                <td>{{row[0]}}</td>
                <td>{{row[1]}}</td>
                <td>{{row[2]}}</td>
                <td>{{row[3]}}</td>
            </tr>
        {% endfor %}
    </tbody>
</table>

如果添加新记录并要显示,则需要重新加载整个页面。

我们可以通过任何方式更新output_data变量。因此它将在不刷新页面的情况下将更新的数据显示到表中。

0 个答案:

没有答案