0

I'm tried to display page with infinite scroll on Laravel 5. I can't append my filter keys and split again.

My javascript file:

var win = $(window);
var paginate = 0;

win.scroll(function() {
  if ($(document).height() - win.height() == win.scrollTop()) {
    paginate += 10;
    <?php $i = 0; ?>
    var postForm = { 
        'filters'     : "@foreach($filters as $filter)[['{{ $filter[0] }}', '{!! $filter[1] !!}', '{!! $filter[2] !!}']@endforeach",
        'paginate'    : paginate,
        'postCategory': "infinite",
        '_token'      : "{{ csrf_token() }}"
    };

    $('#loading').show();
    $.ajax({
      url: '{{ url('/campaigns/') }}',
      data: postForm,
      type: 'POST',
      dataType: 'html',
      success: function(html) {
        $('#campaigns').append(html);
        $('#loading').hide();
      }
    });
  }
});

My Store function

 $filters = $request->get('filters');
 $paginate = $request->get('paginate');
 $campaigns = Campaign::where($filters)->get();
 return view('campaigns.indexDatas')
 ->with('campaigns', $campaigns);

How can i append my current filter keys to search store function?

Like this:

targetPercent > 100
Rys
  • 450
  • 1
  • 6
  • 18

0 Answers0