How to load articles when scrolling via ajax from an array?

Good day. The problem is this, the data to load on the page come from a different server and in large quantities (1K+) records of the average user's query. The data arrives in the array, then the array loaded entirely on the page.

Can you tell me how to load when you scroll the data from the array 50 via ajax? Record this data in the database I can't.

Thank you.
June 10th 19 at 15:20
2 answers
June 10th 19 at 15:22
Record this data in the database I can't.

Very good? In any? Even just in a file on the server to create?

Jedi is a difficult path to take https://developer.mozilla.org/en-US/docs/Web/API/S... (not supported in ie/edge)
And send to client on the same record continuously.

Meanwhile on the client to write the data into the https://developer.mozilla.org/ru/docs/IndexedDB/Us...
and when you scroll to have to get data from IndexedDB in the desired range.
1 the user submits a query, the result is returned in an array. The output is multidimensional, associative array in the 1K keys, each key for about 10 values, some of which this article.

Imagine, each request record in the database of at least 1000 articles + about 10 000 elements associated with these articles.

How much time will it take and what if these users will be 300 pieces? - federico commented on June 10th 19 at 15:25
If you need to give the user 50 elements, and cut the data on such portions sax parser. No 11K inserts. A maximum of 20 will be. In your case, you can just for files to stuff. - Marty93 commented on June 10th 19 at 15:28
June 10th 19 at 15:24
I see here two solutions.
1. Any way you like, but write in any place (file/DB) of the array.
2.To as it is, even a million, but output to the page limit foreach or while loop to 50pcs.

Although I could be wrong, but once you get the data from another server, it is likely that servers have the ability to give a certain number of records. He did not just give, there must be some parameters.

Find more questions by tags AJAXPHPJavaScript