【问题标题】:gravity forms fire js event on successfull form submission重力表单在表单提交成功时触发 js 事件
【发布时间】:2015-10-12 11:19:54
【问题描述】:

是否有可能以重力形式在成功的 ajax 表单传输时触发 javascript 事件?

在显示的响应中添加 html javascript 似乎不起作用,例如:

<script>console.log("successful-form-transmition");</script>

【问题讨论】:

  • 向文本添加纯 JavaScript 也可以。 “脚本”中有一个拼写错误,导致它无法正常工作。

标签: javascript wordpress gravity-forms-plugin


【解决方案1】:

在成功提交重力表单时触发了一个事件:gform_confirmation_loaded。您可以像这样将它与 jQuery 一起使用:

$(document).on("gform_confirmation_loaded", function (e, form_id) {
  // code to run upon successful form submission
});

See documentation

【讨论】:

  • 谢谢你 - 我只能让它与 bind 一起工作,以防其他人无法继续 -> jQuery(document).bind("gform_confirmation_loaded", function (e, form_id) {
  • 谢谢,但我可以将此代码放在表单中的 html 字段中吗?似乎不适合我
  • 虽然很明显,但请确保您嵌入了激活 ajax 的表单。
猜你喜欢
  • 1970-01-01
  • 2021-07-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-18
  • 1970-01-01
  • 2014-02-26
  • 2013-03-12
相关资源
最近更新 更多