在向下滚动如何进行ajax调用并获取respone数据

1 javascript ajax jquery jquery-ui

请您在向下滚动时指导我如何进行ajax调用

Dee*_*hav 12

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){

                }
            });
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

当用户到达页面末尾时,这会执行ajax调用.

您可以指定它出现的高度.