Michael Falciglia Michael Falciglia - 2 years ago 268
Javascript Question

Wordpress Send Form Data on Redirection in Contact Form 7

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.

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?

This is the redirection page I got from Contact Form 7


Answer Source

Just use this hook:

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download