按钮提交表单HTML双重操作(提交并重新加载)

时间:2018-09-18 11:26:20

标签: html reload submit-button

我有以下html按钮可以正常保存:

<form action="" method="post">    
    <input type="hidden" value="{{ people }}" name="people">
    <input type="hidden" value="{{ number }}" name="number">
    <p>{% trans 'Are you sure you want to save people' %} {{ people }} {% trans 'where number is' %} {{ number }}?
    </p>

    {% buttons %}
        <button class="btn btn-default hover-linea" id="cancel" type="button">
            {% bootstrap_icon "remove" %} {% trans 'Cancel' %}
        </button>
        <button type="submit" class="btn btn-default hover-linea">
             {% bootstrap_icon "log-out" %} {% trans 'Save' %}
        </button>
        {% endbuttons %}

保存时,我需要将前一页重新加载到表单中。我想按Save并执行与现在相同的操作,但还要对相对链接为(../people.html)的页面进行location.reload()。

我在等待答案,非常感谢。

1 个答案:

答案 0 :(得分:0)

您的服务器端表单处理程序(已在action中指定了URL)属性应通过HTTP重定向(状态302Location:标头)响应给您要浏览器加载的URL。

相关问题