Breaking

how to load more data on scroll using ajax ,php, ajax


Ajax is a group of interrelated Web development techniques used on the client-side to create asynchronous Web applications.

now,we write a code for us to get more data on scroll .

its so easy when you  'll go through below code:-

Note : - DOM id's and class are taken as an example you can change it according your need .




$('#loader-icon').hide();
              jQuery(function($){
                  $('#test').bind('scroll', function(){
                            if($(this).scrollTop() + $(this).innerHeight()>=$(this)[0].scrollHeight){
                              getresult("t2.html");
                            }
                          })
                  });

              function getresult(url) {
                      $.ajax({
                        url: url,
                        type: "GET",
                        beforeSend: function(){
                          $('#loader-icon').show();
                          },
                        complete: function(){
                            $('#loader-icon').hide();
                          },
                        success: function(data){
                           $("#test").append(data);
                          },
                        error: function(){}          
                      });
                    }



No comments:

Powered by Blogger.