On Scroll down how to make ajax call and get the respone data

15,490
var no=1;
$(window).scroll(function () {
    if(no==1)
    {
        if ($(window).height() + $(window).scrollTop() == $(document).height()) {
            no=2;
            $.ajax({
                type: "POST",
                url: "request.php",
                data: datas,
                cache: false,
                success: function(html){

                }
            });
        }
    }
});

This does an ajax call when a user reaches at end of page.

You can specify a height at which it occurs.

Share:
15,490
Admin
Author by

Admin

Updated on June 14, 2022

Comments

  • Admin
    Admin almost 2 years

    Please can you people guide me how to make ajax call when scroll down