【问题标题】:posting html form data redirect发布 html 表单数据重定向
【发布时间】:2015-12-05 19:34:39
【问题描述】:

我正在使用 HTML post 和 action attr 将模态数据发布到后端。表单发布很好并更新了后端,唯一的事情是在按下提交 url 更改并将我带到我的 POST url 之后。这怎么能阻止?单击提交后,我想留在同一页面上,并且只需更新后端而不被带到我的 POST url。

<form method="POST"id="goForm"action="http://post_endpoint"enctype="application/x-www-form-urlencoded">
    Name: <input type="text" value="">
    <button type="submit value="submit">Send<button>

</form>

【问题讨论】:

标签: html forms rest http post


【解决方案1】:

要在不重新加载页面的情况下提交 HTML 表单,您必须使用 Javascript。

这是一个类似的问题和答案:Submit form without page reloading

【讨论】:

    猜你喜欢
    • 2015-12-25
    • 2021-02-13
    • 2012-08-19
    • 1970-01-01
    • 1970-01-01
    • 2016-07-16
    • 1970-01-01
    • 2013-10-11
    • 2023-03-06
    相关资源
    最近更新 更多