Loading contact form 7 scripts over ajax does not work
-
I use a custom ajax version of wordpress which loads each page over ajax (instead of doing full page refreshes). If I reach a page that requires a contact form, I dynamically load the contact form 7 scripts (jquery.form.min.js and scripts.js). This script however will fail on line:
_wpcf7.supportHtml5 = $.wpcf7SupportHtml5();It doesn’t find the wpcf7SupportHtml5 function. This is because the line:
$.wpcf7SupportHtml5 = function() {hasn’t been executed at this point.
If however, I move this:
$(function() { _wpcf7.supportHtml5 = $.wpcf7SupportHtml5(); $('div.wpcf7 > form').wpcf7InitForm(); });to the bottom of the file, beneath the declaration of the wpcf7SupportHtml5 function, it all works well. I know I am using your plugin in a very slightly unusual way, but your scripts could be a little more resilient for this case.
It would be amazing if you could patch the code in this way for a future release, as it would make it that bit more robust.
Best wishes,
Will
The topic ‘Loading contact form 7 scripts over ajax does not work’ is closed to new replies.