我有一个HTML表,显示新闻标题和新闻来源。新闻文章来自JSON对象。我不知道如何保存它,只需单击(从JSON数组中提取适当的元素)旁边的“提交”按钮即可保存特定的文章。我想将其返回/保存到某种输出中,然后可以存储在SQL中。请帮忙吗?
该表如下所示:
<thead>
<tr>
<th>Article</th>
<th>News Source</th>
</tr>
</thead>
<tbody>
{% for article in articles.articles %}
<tr>
<div id = {{ article.title }}>
<td><a href = {{ article.url }}>{{ article.title }}</a></td>
<td>{{ article.source.name }}</td>
</div>
<td><form method="post"><button class="btn btn-primary" type="submit">Save to profile</button></form></td>
</tr>
{% endfor %}
</tbody>
</table>