Bmax
Bmax

Reputation: 630

How to submit contact form 7 without page refresh in wordpress?

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

Answers (5)

LetsGoLlama
LetsGoLlama

Reputation: 1

After verifying that one of the main reasons why the page refreshes when submitting the form are:

  1. JavaScript file is not loaded: If you are using themes downloaded from the store, usually the problem is with page optimizers like Lite Speed Cache. Otherwise check that your themes are loading the Ajax file correctly.

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.

  1. Conflicts with other JavaScript

  2. HTML structure is not valid

Upvotes: 0

Gautam Arya
Gautam Arya

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

Sabir Hussain
Sabir Hussain

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

Joab Alves
Joab Alves

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

Bmax
Bmax

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

Related Questions