Ajax error $forms.each is not a function
-
scripts_es6.js:1114 Uncaught (in promise) TypeError: $forms.each is not a function
i made ajax to bring contact form. my code is bellow:const response = await fetch(
templateURL + ‘ajax_form.php?’,
{
method: ‘POST’,
body: formattedFormData
}
);
const data = await response.text();
document.getElementById(“modal-form”).innerHTML = data;document.querySelectorAll(“.wpcf7 > form”).forEach((
function(e){
console.log(e);
wpcf7.init(e);}
));wpcf7cf.initForm(document.getElementsByClassName(‘wpcf7-form’)[0] );
i get response correct and wpcf7.init(e); works fine! the problem is on
wpcf7cf.initForm(document.getElementsByClassName(‘wpcf7-form’)[0] ); i get the error i told above.
thank in advanced!
- The topic ‘Ajax error $forms.each is not a function’ is closed to new replies.