请您在向下滚动时指导我如何拨打电话
答案 0 :(得分: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){
}
});
}
}
});
当用户到达页面末尾时,这会进行ajax调用。
您可以指定它出现的高度。
答案 1 :(得分:0)
这是关于在滚动时触发事件的单独堆栈溢出问题:
jQuery window scroll event does not fire up
这是jquery的手册,展示了如何使用ajax:
http://api.jquery.com/jQuery.ajax/
结合并享受!