In my rails 3 application, I have a page which needs to periodically check with the server for updated information and then update an unordered list accordingly. Following the example shown at Rails 3 equivalent for periodically_call_remote, I converted into the appropriate CoffeeScript and created the necessary .js.erb partial.
The page calls the server and the server responds with the correct js file, but nothing on the page can be modified. alert('foo');
works fine, but anything on the order of .html()
or .replaceWith()
will not.
Here's my CoffeeScript:
$(document).ready ->
setInterval () ->
$.ajax url: "programs", type: "GET", dataType: "script"
, 10000
and the corresponding .js.erb:
$("#programlist").html("<%= escape_javascript(render @programs) %>");
Is something wrong here?