修改了轨道投影轨道上的轮询更改

时间:2013-02-26 00:57:48

标签: javascript jquery ruby-on-rails ruby-on-rails-3

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

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()

我做错了什么? 谢谢

1 个答案:

答案 0 :(得分:1)

尝试更改第一行 从

@CommentPoller ->

CommentPoller =
相关问题