I'm following along with Ryan Bates' http://railscasts.com/episodes/114-endless-page-revised. The initial alert box, he demonstrates, that appears after scrolling to the bottom works fine, but I'm unable to get anything after that to work properly.
Let's have a look:
photos/index.html.haml
#photos
= render @photos
= will_paginate @photos
photos_controller.rb
def index
@photos = Photo.order('created_at DESC').paginate(:per_page => 20, :page => params[:page])
photos.js.coffee
jQuery ->
$(window).scroll ->
if $(window).scrollTop() > $(document).height() - $(window).height() - 50
$.getScript($('.pagination .next_page').attr('href'))
photos/index.js.erb
$('#photos').append('<%= j render(@photos) %>');
<% if @photos.next_page %>
$('.pagination').replaceWith('<%= j will_paginate(@photos) %>');
<% else %>
$('.pagination').remove();
<% end %>
As far as I can tell, I've set up everything properly, but when I scroll to the bottom of the page, nothing get loaded. I've just noticed it DOES make a GET request in my logs, but nothing actually appears in the browser... Any thoughts?