Wordpress在联系表单7中发送重定向表单数据 [英] Wordpress Send Form Data on Redirection in Contact Form 7

查看:94
本文介绍了Wordpress在联系表单7中发送重定向表单数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用名为Contact Form 7的流行wordpress插件。通过添加此代码 on_sent_ok提交到任何页面后,可以轻松地重定向表单:location ='http://example.com /';,但它没有输入的表格值,因为它是一个AJAX提交。

I'm using the popular wordpress plugin called Contact Form 7. Its easy to redirect the form after submitting to any page by adding this code on_sent_ok: "location = 'http://example.com/';", but it does not carry the form values entered over, because its an AJAX submit.

网站的说明是`最简单的方法是使用on_sent_ok JavaScript动作钩子。通过使用此挂钩,您可以指定在成功提交表单后要运行的JavaScript代码。您可以在联系表单管理页面的底部找到附加设置字段。

The sites directions says `The simplest way is using on_sent_ok JavaScript action hook. By using this hook, you can specify a JavaScript code that you wish to run after the form is successfully submitted. You will find the Additional Settings field at the bottom of the contact form management page."

是否有人能够帮助或解释我如何将表单值带到重定向?

Would anyone be able to help or explain how I could carry the form values over on the redirect?

这是我从联系表格7获得的重定向页面

This is the redirection page I got from Contact Form 7

http://contactform7.com/redirecting-to-another-url-after-submissions/

推荐答案

只需使用此钩子:

on_sent_ok: "location = 'https://gettinmobile.com/my-account/checkout/?level=1&' + $('form.wpcf7-form').serialize();"

这会将所有表单数据作为参数追加到查询字符串中。

This will append all the form data as parameters in the query string.

来自玻利维亚拉巴斯的干杯

Cheers, from La Paz, Bolivia

这篇关于Wordpress在联系表单7中发送重定向表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆