Ruby on Rails Wednesday, January 23, 2013

Heptagone H wrote in post #1093275:
> app/assets/javascripts/comments.js.coffee
> [code]
> jQuery ->
> $('#comments_id').dataTable
> sPaginationType: "full_numbers"
> bJQueryUI: true
> bProcessing: true
> setInterval('$("#comments_id").dataTable().fnDraw()', 1000);
> [/code]

Take a look at the documentation for setInterval():

http://www.w3schools.com/jsref/met_win_setinterval.asp

Looking at the function signature:

setInterval(code,millisec,lang)

code = The function that will be executed.

You have passed a string for this argument. You can't call a string.

Solution: Give setInterval a function as is expected:

In JavaScript it should look something like:
setInterval(function() {
$("#comments_id").dataTable().fnDraw();
}, 1000);

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment