Multiple pagination with kaminari via Ajax

前端 未结 2 1903
南笙
南笙 2021-02-04 06:57

I want to apply multiple pagination with Kaminari via Ajax now here is my code for controller

def user_note
    @user = current_user
    @notes = Bookmark.where         


        
2条回答
  •  不思量自难忘°
    2021-02-04 07:57

    you are missing to pass params at this line

    $('#paginator').html('<%= escape_javascript(paginate(@bookmarks, :remote => true).to_s) %>');
    

    i think it should be like this

    $('#paginator').html('<%= escape_javascript(paginate(@bookmarks, :remote => true, :param_name => 'page_2').to_s) %>');
    

    and you are also passing wrong param at this line

    <%= paginate @bookmarks,:remote => true, :param_name => 'page' %>
    

    it should be like this

    <%= paginate @bookmarks,:remote => true, :param_name => 'page_2' %>
    

    and please also check that whether you are sending the response correctly to the JS file or not.

提交回复
热议问题