jquery - 未捕获的类型错误 : Cannot read property 'post' of undefined Even JQuery included

标签 jquery html

即使我在我的页面中包含了 JQuery,我也会收到这个错误...

Uncaught TypeError: Cannot read property 'post' of undefined 

导致错误的行是

 $.post("infusionsoft/infusion_soft_interaction.php", 
   {customerName: 'customerName', customerEmail: 'customerEmail'},
 function(data) {
        alert(data);
    });

这是我页面的 HEAD 部分。

http://pastebin.com/xK8dWQ1U

最佳答案

我认为问题出在您对 jQuery 使用无冲突模式这一事实。

您需要通过jQuery 引用它。

jQuery.post("infusionsoft/infusion_soft_interaction.php", ...

或者用一个函数包装你的代码

(function($){
    $.post("infusionsoft/infusion_soft_interaction.php", ...
}(jQuery))

关于jquery - 未捕获的类型错误 : Cannot read property 'post' of undefined Even JQuery included,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24774527/

相关文章:

jquery - 当需要变量时,使用 .before() 设置元素的样式

Jquery获取元素的特定类

html - 修复具有两个固定位置父项的 leafletjs map div

javascript - 未捕获的不变违规 : Target container is not a DOM element

javascript - 使用 CSS3/Javascript 的真实世界 3D 模型

javascript - 使用 jQuery 返回隐藏的 <td> 值

javascript - 从字符串中提取特定字符

javascript - 使用 BxSlider 插件后 JQuery 不起作用

javascript - Ajax 用响应替换 html 但在加载 css、js 后加载内容

html - 在以下情况下如何将 div 居中放置在 div 中