【问题标题】:How to avoid redirect with simple html form submit? [duplicate]如何避免使用简单的html表单提交重定向? [复制]
【发布时间】:2017-12-14 17:21:45
【问题描述】:

我为联系页面创建了一个非常简单的 html 表单。我想知道是否可以禁用/避免发送表单时发生的页面重定向,但仍然允许提交表单(显然)。目前我对 php 的了解几乎为零,并且我没有创建 php 方面(参见表单操作)。非常感谢这里的任何帮助。

<form action="http://sonic.dawsoncollege.qc.ca/~dpomerantz/web/contact_me.php" method="post" class="flex flex--column">
                        <input type="hidden" name="toEmail" value="spencer.miller@me.com"/>
                        <input type="text" name="name" placeholder="Name*" required><br>
                        <input type="email" name="email" placeholder="Email*" required><br>
                        <input type="text" name="phone" placeholder="Phone"><br>
                        <input type="text" name="message" placeholder="Message*" required><br>
                        <input type="submit" value="Submit" class="submit">
                    </form>

【问题讨论】:

标签: javascript php jquery html forms


【解决方案1】:

将表单配置为发布到隐藏的 iframe,如下所述:How do you post to an iframe?。重定向仍然会发生,但它会在 iframe 内,因此对用户不可见。这有点小技巧,不是最好的做事方式,但确实有效。

【讨论】:

  • 绝对是一个黑客,但仍然为我完成了工作。感谢帮助的人。非常感谢。
猜你喜欢
  • 2023-03-11
  • 2012-05-24
  • 1970-01-01
  • 2011-12-10
  • 1970-01-01
  • 1970-01-01
  • 2016-04-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多