Now a days we are very familiar to contact form 7 because when we think about any form submission then only contact from 7 clicks to our mind first. As we know we have done so many modifications in the plugin. Here I am sharing about calling any function after form get submitted.

Contact form 7 defines a java script hook that is “on_sent_ok” which can run any java script code just after the form submit. We can use this hook in various ways. I am discussing about few of them. First of all it is most important to know its placement, we need to place this in admin section. Just open the form for which you are applying this hook, then scroll down you’ll find a “Additional Settings” section.

We can place our hook like :

on_sent_ok: "your java script code here" 

Applying alert box after form submit :

on_sent_ok: 'alert("hello");' 

Calling a function after form submit :

on_sent_ok: "my_function();"

These are the few ways to adding this hook to make our work easy. In a case if you want to apply redirect in place of all other then please check here : Redirect after form submit. It is most easy and useful plugin to integrate forms in any wordpress website, we have many ways to modify it easily.