kizinho's avatar

Need Help, i Used Infinite Scroll Pagination with laravel but getting errors

Everything is fine but those data's that loaded with Infinite Scroll Pagination , my reply button can't work on them , it will keep refreshing the page any time i clicked on only new data's

0 likes
6 replies
tykus's avatar

Very difficult to help without your code.

kizinho's avatar

see the code here

laravel blade file

                                                            @foreach($data['comments'] as $comment)
                                                            <li class="comment byuser comment-author-mvpthemes bypostauthor even thread-even depth-1" id="li-comment-{{$comment->id}}">
                                                                <div class="comment-wrapper" id="comment-{{$comment->id}}">
                                                                    <div class="comment-inner">
                                                                        <div class="comment-avatar">
                                                                            <img alt='' src="@if(empty($comment->user_id))  {{asset('images/default.png') }}         @else   @endif" 
                                                                                 srcset="@if(empty($comment->user_id))  {{asset('images/default.png') }}         @else   @endif" class='avatar avatar-46 photo' height='46' width='46' />               </div>
                                                                        <div class="commentmeta">
                                                                            <p class="comment-meta-1">
                                                                                <cite class="fn">@if(empty($comment->user_id))  {{$comment->guest_name}}          @else   @endif </cite>                    </p>
                                                                            <p class="comment-meta-2">
                                                                                July 7, 2017 at 2:50 pm                                         </p>
                                                                        </div>
                                                                        <div class="text">
                                                                            <div class="c">
                                                                                <p>{!! nl2br($comment->comment_text) !!}</p>
                                                                            </div>
                                                                        </div><!-- .text  -->
                                                                        <div class="clear"></div>
                                                                        <div class="comment-reply"><span class="reply">
                                                                                <a onclick="return false;" rel='nofollow' class='comment-reply-link' href='{{url('read/'.$data['read']->subcategory->slug.'/'.$data['read']->slug)}}?replytocom={{$comment->id}}#respond' data-commentid="{{$comment->id}}" data-postid="{{$comment->id}}" data-belowelement="comment-{{$comment->id}}" data-respondelement="respond" aria-label='Reply to Jawn Staff'>Reply</a></span></div>
                                                                    </div><!-- comment-inner  -->
                                                                </div><!-- comment-wrapper  -->
                                                            </li>
    
                                                            @if(count($comment->childs))
                                                            @include('frontend.post.manageComment',['childs' => $comment->childs])
    
    
                                                            @endif 
    
                                                         
                                                            @endforeach
                                                        </ol>
                                                          
                                                    {{ $data['comments']->links() }}
                                                      </div> 
    

    js file

    $('ul.pagination').hide(); $(function() { $('.infinite-scroll').jscroll({ autoTrigger: true, loadingHtml: '', padding: 0, nextSelector: '.pagination li.active + li a', contentSelector: 'div.infinite-scroll', callback: function() { $('ul.pagination').remove(); } }); });

    then i include infinitscroll library

kizinho's avatar

every thing is fine but those new datas's cant response to the reply button again, this type of thing also happened when i used ajax ti refresh my page , after that all the reply button stoped working, thats why am using Infinite Scroll Pagination now

kizinho's avatar

maybe i need to append something like this {! ?page=1 !} for it to know that this page is active

kizinho's avatar

Thanks, but am using APi, how will i handle the part if request has ajax

Please or to participate in this conversation.