Laravel Auto Load more results on Page Scroll using jQuery AJAX

Laravel Auto Load more results on Page Scroll using jQuery AJAX

In this Post We Will Explain About is Laravel Auto Load more results on Page Scroll using jQuery AJAX With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Auto Load More Data on Page Scroll in laravel Example

In this post we will show you Best way to implement Laravel Load data while Scrolling Page down with jQuery AJAX, hear for Auto Load More Data on Page Scroll (Ajax, jQuery, Laravel) with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Also Read :   Angularjs Loading Progress Bar percentage spinner

Step1: Create Simple Table and Model in Laravel

Fist of all I shall make the first students table and laravel

//include namespace
namespace App;
use Illuminate\Database\Eloquent\Model;
class Student extends Model
	//database field initgrate using model
    public $fillable = ['name','details'];

Step2: Add Routes in Laravel

In this second step, I shall add laravel routes to handle file or



Step3: Create StudentController in laravel

In this 3rd step to see, I shall make a file laravel controller in following laravel path Like as a app/Http/Controllers.



//include namespace
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Student;
class StudentController extends Controller {
    public function loadMore(Request $request){
        foreach ($students as $student) {
            $html.='<li>'.$student->id.' <strong>'.$student->name.'</strong> : '.$student->details.'</li>';
        if ($request->ajax()) {
            return $html;
        return view('files.loadmore',compact('students'));

Step4: Create Blade File

In this Last step, I shall make a HTML view file within laravel app files directory therefor first make files directory after that make a loadmore.blade.php within file folders folders Like as a(resources/views/files/loadmore.blade.php)

Also Read :   How to Get last inserted ID using Laravel


.wrapper > ul#dataoutput li {
  margin-bottom: 2px;
  background: #3d3d3d;
  padding: 22px;
  list-style: none;
  text-align: center;
<div class="wrapper">
    <ul id="dataoutput"><!-- dataoutput dsipaly here --></ul>
    <div class="ajax-liveload"><img src="{{ asset('images/liveload.gif') }}" /></div>
var livepage = 1; //track student scroll as livepage some number, right now livepage number is 1
more_data(livepage); //initial data content load
$(window).scroll(function() { //detect livepage scroll
    if($(window).scrollTop() + $(window).height() >= $(document).height()) { //if student scrolled from top to bottom of the livepage
        livepage++; //livepage number increment
        more_data(livepage); //load content   
function more_data(livepage){
            url: '?livepage=' + livepage,
            type: "get",
            datatype: "html",
            beforeSend: function()
            if(data.length == 0){
                //notify student if nothing to load
                $('.ajax-liveload').html("No more records!");
            $('.ajax-liveload').hide(); //hide liveload animation once data is fetched
            $("#dataoutput").append(data); //append data into #dataoutput element          
        .fail(function(jqXHR, ajaxOptions, thrownError)
              alert('No response from server');

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Also Read :   jQuery Ajax Price Range Slider as Search Filter in PHP MySQLi


I hope you have Got What is Laravel Infinite Scroll with jQuery and AJAX And how it works.I would Like to have FeedBack From My Blog( readers.Your Valuable FeedBack,Any Question,or any Comments about This Article( Are Most Always Welcome.