• I am loading my page contents using AJAX, so even though the Javascript for ContactForm7 is loaded in the footer, since the page contents and the Contact Form is loading via AJAX, the $(‘div.wpcf7 > form’).ajaxForm (line 10) function is not binding properly.

    Does anyone know of a way that I can bind the form dynamically after/during the AJAX call, please? (ideally without hacking the ContactForm7 plugin core – I can modify the AJAX call for the pageload all I want – I am using a customized version of the plugin “AJAX page loader 1.5” for that)

    The test site is located at: knome.earthman.ca (load the contact page from the homepage via ajax with the menu link)

Viewing 1 replies (of 1 total)
  • hello,

    you must execute script that binds all events on your contact form each time you add it to DOM tree, if you are making it AJAX-way.

    the simplest method is to include the following code:

    <script src="/wp-content/plugins/contact-form-7/scripts.js"></script>

    in your contact form template

    or add

    jQuery.get('/wp-content/plugins/contact-form-7/scripts.js', function(data) { eval(data); });

    after you have added the form to the DOM tree

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Contact Form 7] Bind .ajaxForm after loading form via AJAX’ is closed to new replies.