Short version; jquery_ujs appears to conflict with Kaminari's AJAX support and I don't know why.
In my Rails 4 app, I have the following lines in my application.js
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require_tree .
If I remove jquery_ujs, then the following code stops working; it starts sending GET requests instead of DELETE requests and the user, per sending a GET request, simply receives the show page for the resource.
<%= link_to 'Delete Horse', horse, method: :delete, data: { confirm: 'Are you sure?' } %>
But if I leave jquery_ujs in, Kaminari w/ AJAX stops working....
<%= paginate @horses, :remote => true %>
goes nowhere when clicked (though the HREF tag in the rendered HTML is correct).
If I remove :remote => true from the paginate @horses link, then the link starts working. But, A) I'd like the AJAX to work for the sake of user experience, and B) I would like to understand why this is all happening.
You will need to have your js.erb file to handle the request from Kaminari. In your js.erb, you should place the Javascript code to replace the current content with your new content from server.
So in your case, it sends the request as JS and that is the correct behavior. You can look at the reference here. http://jyothu-mannarkkad.blogspot.com/2013/06/rails-kaminari-ajax-pagination.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With