wordpress 外贸建站
WordPress外贸营销网站一站式解决方案
13714251660     191919168

技术博客

» 技术博客

Contact Form 7成功发送邮件后跳转到感谢url页面

2018年6月8日

只需要在代码里加入下面的代码即可:

<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'http://example.com/';
}, false );
</script> 

支持的监听事件:

List of Contact Form 7 Custom DOM Events

  • wpcf7invalid — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because there are fields with invalid input. 当已经提交表单成功但是有不无效的字段的时候触犯发此事件。
  • wpcf7spam — Fires when an Ajax form submission has completed successfully, but mail hasn’t been sent because a possible spam activity has been detected. 垃圾邮件。
  • wpcf7mailsent — Fires when an Ajax form submission has completed successfully, and mail has been sent. 成功发送时。
  • wpcf7mailfailed — Fires when an Ajax form submission has completed successfully, but it has failed in sending mail. 发送失败时。
  • wpcf7submit — Fires when an Ajax form submission has completed successfully, regardless of other incidents. 提交后。

也许您也喜欢