0

你好

我有一个关于可能的简单和良好工作解决方案宽度 jquery 的问题。如何从 sql 中追加 ajax 表

https://www.inforegister.ee/BACEXSQ-ARGOS-KRACHT

使用“向下滚动”事件(ajax 重新加载表后的宽度)宽度查找表单?首先,我有一个包含creat table tbl1(id int auto_increment,name varchar(200));数百条记录的 mysql 表。从它自动附加例如 10 条记录。

Html 代码看起来像:

<form>
<input type="text" id="find" >
<input type="buttom" id="findb" >
</form>
<table></table>

谢谢

4

3 回答 3

1

If you look at the source, you'll see that they're making use of the scroll event:

jQuery(window).scroll(function(){
    if(jQuery("#nextCompaniesCount").val() > 0) {
        if (jQuery(window).scrollTop() == jQuery(document).height() - jQuery(window).height()){
            loadNextCompanies();
        }
    }
});

Look at the source and you'll also see the loadNextCompanies() function, which performs an AJAX request and then adds any HTML to the body.

If you're wanting to add new items to the end of a table, you can use something like:

$('#id_of_table > tbody > tr:last').after(newRow);

newRow would contain the tr html that you want to add.

于 2013-01-24T09:36:13.490 回答
0

韦恩惠蒂的回答是要走的路,但我想补充一点:

如果您在链接到的页面上快速滚动,您会看到加载图像出现多次。发生这种情况是因为用户在加载新内容之前再次到达页面底部。

您可以通过在再次调用 loadNextCompanies() (或您的等价物)之前检查您是否已经在等待来自服务器的响应来提高效率。

更新: 你要求一个插件——虽然我从来没有使用任何插件来实现这个,所以我不能提出任何建议,我可以告诉你这叫做延迟加载,快速搜索会发现这个插件:https:// code.google.com/p/jquerylazyscrollloading/

于 2013-01-24T10:12:39.873 回答
0

嘿,这是您正在寻找的插件。

http://masonry.desandro.com/demos/infinite-scroll.html

看看上面的例子。

于 2013-01-24T10:13:13.337 回答