How to lazyload a standard html table that has many rows?

前端 未结 2 1603
星月不相逢
星月不相逢 2021-02-10 01:04

Instead of using a table plugin by someone else, I choose to do it the standard HTML way of making Tables and rows etc etc. I would fetch data from a database to fill the rows.

2条回答
  •  独厮守ぢ
    2021-02-10 01:31

    I haven't heard of a plugin that can do something like this, but I mostly avoid fancy JS "libraries". That being said conceptually, you can use an AJAX request to select for example images where m>id>n, then in your javascript when you want to load more images, do another ajax request, but increment m and n by 100 for example.

    Lots of open source gallery frameworks exist that operate on this principle, but usually, they generate the page using php, instead of dynamically altering the inner html using AJAX.

    Here is how to get database data out of AJAX and into JS. http://www.w3schools.com/ajax/ajax_database.asp

提交回复
热议问题