从HTML表/ JSON分析的对象数组中选择并存储元素

时间:2018-11-29 03:33:12

标签: javascript html sql json select

我有一个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>

0 个答案:

没有答案