Trying to implement ajax polling using the RailsCast tutorial on ajax polling (#229) but encountering an issue where the alert box doesn't pop up after running the server.
Here's the code in app/views/quotes/index.js.erb:
alert('Hey');
QuotePoller.poll();
In app/assets/javascripts/quotes.coffee:
@QuotePoller =
poll: ->
setTimeout @request, 1000
request: ->
$.get($('#quotes').data('url'))
jQuery ->
if $('#quotes').length > 0
QuotePoller.poll()
In app/views/quotes/index.html.erb:
<div id="quotes" data-url="<%= quotes_url %>">
<table>
<thead>
<tr>
<th>Content</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @quotes.each do |quote| %>
<tr>
<td><%= quote.content %></td>
<td><%= link_to 'Show', quote %></td>
<td><%= link_to 'Edit', edit_quote_path(quote) %></td>
<td><%= link_to 'Destroy', quote, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>