Reputation: 630
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.
Upvotes: 7
Views: 27639
Reputation: 1
After verifying that one of the main reasons why the page refreshes when submitting the form are:
This was my case, the Js files were loading in delay, I was using a Page Cache which was speeding up the web page but not loading the javascript files correctly.
Conflicts with other JavaScript
HTML structure is not valid
Upvotes: 0
Reputation: 723
I have recently experienced this problem. I have opening a form inside popup and submit would refresh it.
So, after some much hair pulling I happened to view source and there I noticed some part of footer code wasn't highlighted. Why? turns out it was my silly mistake. I forgot to close one iframe
tag. Once I closed it. view source code was perfectly highlighted and the problem was resolved.
Upvotes: 0
Reputation: 2922
Add wp_head()
funtion in your header.php file and wp_footer()
function in footer.php file.
That's it solved :)
Upvotes: 3
Reputation: 11
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>
Upvotes: 1
Reputation: 630
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.
Upvotes: 5