Linked Questions

Popular Questions

How to create an Laravel Pagination to AJAX

Asked by At

Is laravel pagination links() still working on Jquery?

I have module that I need to list all the data in html using ajax and laravel api. and must have pagination, Now I already created function to list all data in html, Let me show you the codes.

    $(document).ready(function(){
    $.ajax({
        url:'http://localhost:8000/api/news_event',
        dataType: "json",
        contentType: "application/json",
        success:function(response) {

            console.log(response);

            var news_event = response[0].news.data;
            $.each(news_event, function (index, el) {

                var stringify_list_news_event = jQuery.parseJSON(JSON.stringify(el));
                var news_event_title = stringify_list_news_event['content_title'];
                var news_event_content = stringify_list_news_event['content'];
                var news_event_content_id = stringify_list_news_event['content_id'];


                var news_event_data;

                news_event_data = '<a href="/news_event_content/'+news_event_content_id+'" style="color:black; text-decoration: none; ">\
                                      <h5 style=" font-size:20px;  font-weight: bold; ">'+news_event_title+'</h5>\
                                   </a> <p>'+news_event_content+'</p><br><br>';



                $('.news_event_data').append(news_event_data);

            });


        },
        error:function(response) {
            console.log(response);
        }
    });
}); 

And my html where data will append

<div class="news_event_data">

</div>

Related Questions