I don't see what the issue should be with using remote: true
. Someone else suggested to use .ajax
instead of remote: true
, but that's exactly what the remote functionality does, so there shouldn't be any difference.
The other answer has code that explicitly uses jQuery.ajax
, but the only difference in their code compared to what the remote functionality does is that they're specifying an explicit dataType
. You can actually do that with remote: true
though.
In your HTML link, you just need to specify data-type="script"
. Or, based on your posted JS, you'd do this:
$(function(){
$('.pagination a').attr('data-remote', 'true').attr('data-type', 'script');
});
EDIT: Also, I wrote more in-depth about the data-type attribute and how it works with Rails here: http://www.alfajango.com/blog/rails-3-remote-links-and-forms-data-type-with-jquery/