How to submit contact form 7 without page refresh in wordpress?
19,857
Solution 1
I found the fault, the issue was i haven't included the wp_head() and wp_footer() functions in my theme.
There's a page in contactform7 site on this:
https://contactform7.com/why-isnt-my-ajax-contact-form-working-correctly/
there they have mentioned the requirements for ajax to work.
Solution 2
My problem was solved by changing the jquery used. Check the version you are using.
<script
src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous">
enter code here
</script>
Solution 3
Add wp_head()
funtion in your header.php file and wp_footer()
function in footer.php file.
That's it solved :)
Author by
Bmax
Updated on June 14, 2022Comments
-
Bmax almost 2 years
Hi I'm pretty new to contact form 7. I've seen on Youtube tutorials, that contact form 7 submits without page refresh. But when I install the plugin it's working with a page refresh.
Please advise on how to enable it to work without page refresh. Thanks.
-
moreirapontocom over 4 yearsI was using the jQuery slim version. I just changed to the non-slim and it worked. Thank you.
-
Dushan about 4 yearsI had forgotten to add wp_footer() in footer.php and that was the issue. Thanks for your answer.