问题描述
我们在 wpengine 上托管 wordpress 网站.在这个站点上,我们使用重力形式,但由于某种原因它停止工作.我们得到的只是一个js错误
We are hosting wordpress sites on wpengine. On this one site we are using gravity forms but for some reason it stopped working. All we get is a js error
Uncaught ReferenceError: gformInitSpinner is not defined (index):135
(anonymous function) (index):135
o jquery.min.js:2
p.fireWith jquery.min.js:2
e.extend.ready jquery.min.js:2
c.addEventListener.B
现在,如果我在本地机器上设置站点,它就可以正常工作.有没有人遇到过这个问题?有人知道为什么会这样吗?
Now if I set up the site on my local machine it works perfectly fine. Has anyone come across this problem? Anyone got any idea why this is happening?
推荐答案
这个问题的最常见原因是gravityforms.js 文件在页脚中包含在页脚中,而它应该在页眉中.
The most common cause of this issue is the gravityforms.js file being included down in the footer when it should be up in the header.
如果您使用函数调用嵌入表单,则应使用第二个函数调用将脚本和样式表包含在 header.php 中
If you are embedding the form using the function call there is a second function call you should use to include the scripts and stylesheets in the header.php
// gravity_form_enqueue_scripts($form_id, $ajax);
gravity_form_enqueue_scripts(4, true);
https://docs.gravityforms.com/gravity_form_enqueue_scripts/
这篇关于重力形式上的js错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!