Ajax Bootstrap Popover:对象#<Object>没有方法'popover'

Ves*_*led 10 ajax popover twitter-bootstrap

我正在尝试构建一个Ajax Bootstrap Popover来显示包含评级星系统的页面.

这里的javascript第一次运行得很好.然后我有这个错误:

未捕获的TypeError:对象#没有方法'popover'

我不是很擅长jQuery,但我想这似乎是由于ajax调用,但我无法找到问题所在.

$(".myRate")
        .popover({
            offset: 10,
            trigger: 'manual',
            animate: false,
            html: true,
            placement: 'top',
            template: '<div class="popover" onmouseover="$(this).mouseleave(function()  {$(this).hide(); });"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'

        });
$('.myRate').mouseenter(popoverDisplay);

popoverDisplay = function() {
var el = $(this);
var _data = el.attr('alt');
$.ajax({
     type: 'GET',
     url: 'notes.php',
     data: _data,
     cache: false,
     dataType: 'html',
     success: function(data) {
        el.attr('data-content', data);
        el.popover('show');
     }
  });
}
Run Code Online (Sandbox Code Playgroud)

我不知道我做错了什么......有什么想法吗?

编辑:

搜索后,似乎是加载的页面导致此错误.

正是这部分:

似乎加载jquery-1.7.2.js会产生错误,因为如果我删除它,错误就会消失.问题:我无法删除它因为没有它jRating不再起作用:/

Zub*_*bin 23

运行rails twitter bootstrap生成器,然后切换到bootstrap-sass后,我遇到了这个问题.

它是由文件名冲突引起的,因为boostrap-sass引用bootstrap.js而不是twitter/bootstrap,后者与生成的文件冲突.

只需将生成的app/assets/javascripts/bootstrap.js.coffee重命名为其他内容,例如app/assets/javascripts/bootstrap_and_overrides.js.coffee,就可以了.

  • 这解决了它.进行投票.:) (2认同)

Hay*_*ian 7

我有这个问题,因为我试图从引导使用jQuery的同时,也从googleapis进口的jQuery(就像在说http://railscasts.com/episodes/205-unobtrusive-javascript)如果你使用的引导,你"我有jquery