let url = "your/api/endpoint";
let limit = 1000; //chunk size per 1 request
let resultData = [];
function loadChunk(from) {
ajax(`${url}?limit=${limit}&from=${from}`, function success(chunkOfData) {
resultData.push(chunkOfData);
if(chunkOfData.length == limit) loadChunk(resultData.length);
})
}
loadChunk(0);