I’ve just figured out a solution!
When we load cf7 via ajax, the action attr of the form becomes “admin-ajax.php#…..”, and that’s causing the issue!
To fix this issue, I applied .attr(‘action’, ‘#’) to the form.
Here is the js:
+(function ($) {
$(function(){
$.ajax({
type:"POST",
url: ajaxurl,
cache: true,
data: {
'action':'ajaxCF7',
timeout: 12000
}
}).done(function(data){
$('#content').append(data)
.find('.wpcf7 > form').attr('action', '#').wpcf7InitForm();
});
});
})(jQuery);
-
This reply was modified 7 years, 10 months ago by mitsuki.