javascript 成功提交表单时,重力表单会触发 js 事件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31565566/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 13:59:24  来源:igfitidea点击:

gravity forms fire js event on successfull form submission

javascriptwordpresswordpress-plugingravity-forms-plugin

提问by Manuel

Is it in gravity forms anyhow possible to fire an javascript event on an successful ajax form transmittion?

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

Adding html javascript into the displayed response does not seem to work eg:

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

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

回答by Abraar Arique Diganto

There's an event fired upon successful Gravity Forms submission: gform_confirmation_loaded. You can use it with jQuery like so:

成功提交 Gravity Forms 后会触发一个事件:gform_confirmation_loaded. 您可以像这样将它与 jQuery 一起使用:

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

See documentation

查看文档