Support the ongoing development of Laravel.io →
posted 9 years ago
Laravel.io

Hi all i have built a e-shop with laravel 4.2 currently i have done product filter which have the pagination with products per page, every thing is works fine other than pagination.

Issue is once the ajax request has been posted then i have click pagination link page 2 the pagination data for $products->links() will be lost,so i need to fetch the $products->links() data to Ajax.

Here my controller call for pagination query:

 if(Input::get('ajax')){
       $products = $products_query->paginate(Input::get('pagination')); 
       $this->layout = View::make('layouts.ajax');
       $viewfile = 'frontend.categories.ajax_products'; 
   }

Here is my view:

 <div class="page-setup">
 {{$products->links()}}
</div>

Here is Ajax Call:

   var ajax_filter = function(filldata) {
    var slug = '{{$available_price_range["slug"] or ''}}';
    var fdata = {
        ajax: 1,
        minprice: 0,
        maxprice: '',
        search_keyword: $('#search_keyword').val(),
        attribute_value_id : ''
    }
    var data = $.extend({}, fdata, filldata);
    //console.log(data)
    $.ajax({
        url: '{{URL::to('/')}}/category/'+slug,
        type: 'post',
        data: data,
        success: function(resp) {
            alert(resp);
            $('.fabric_thumb1').html(resp);
            $('.page-setup').html();
        }
     })
   }

So i need to get the $products->links() data to the Ajax call Kindly please help me to resolve the issues.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

yokeswar yokeswar Joined 9 Oct 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.