无限滚动加载下一个结果页面xml


infinite scroll load next results page xml

我正在一个网站上工作,从api中获取xml格式的项目。我已经创建了一个php页面来解析xml api调用,并接受一个$pagenumber变量来获取相应的数据。以下是网站链接:http://phantom - 3. - com/resindex2.php?u=car部分批发

在本页中被调用resindex-items.php吗?pagenumber = 1这是显示产品结果的XML解析脚本。

我想添加无限滚动到每个滚动它获取的每个连续页面。

resindex-items.php?pagenumber=1
resindex-items.php?pagenumber=2
resindex-items.php?pagenumber=3

请原谅我的无知,我已经编码了大约1个月了。

我知道我必须使用jquery和ajax来更新div.但是我不知道如何实现实际的代码。

你的问题不太清楚。但是你想要的是使用Javascript,所以当你向下滚动时,它将触发一个事件来调用Ajax,该事件将返回到Div

这样的东西应该能起作用。

$(window).scroll(function () {
  if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
      .load('stuff.php',{},function(){
          $(this).append('<div id='"text'"></div>");
       });
  }
});