0

我正在尝试跟踪更改轮询,但出现以下错误

Uncaught TypeError: Object [object global] has no method CommentPoller

这是我的comment.js.coffee 文件中的代码

# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

@CommentPoller ->
  poll: ->
    setTimeout @request, 5000

  request: ->
    $.get($('#comments').data('url'))

jQuery ->
  if $('#comments').length > 0
    CommentPoller.poll()

我做错了什么?谢谢

4

1 回答 1

1

尝试将第一行从

@CommentPoller ->

CommentPoller =
于 2013-02-26T01:08:07.523 回答