I need and Advice here.
I have this situation, trying to get some JSON Data, thought the AJAX (using jQuery).
The idea is it, I need more data then 1 or 2 Ajax Call to get all data what I need.
So, I need to make multi Ajax Calls and I try to find out the best way to do that (The best practice).
One idea which came first in my head is something like this (it can have some syntax erros or even something worse, looking for a logic for now):
var dataArr = {
page:0,
pageSize : 1000
};
var StoreData = [];
var getSomeData = function () {
$.ajax({
type : "GET",
url : URL,
data : dataArr,
dataType : "json",
error : OnLoadError,
success :function(data, status){
StoreData.push[data];
if(data.length){
dataArr.page = dataArr.page + 1
getSomeData();
}
}
});
};
Additional info:
It can be around 4-9 Ajax call to gett all data which is (4000-9000 items).
I tested pageSize : 1000
and works fine so I can get for sure 1000 items per call.
So if you can help me with some advice, some changes in existing one or another better way to do that, or even some example, I really appreciate
Thanks Everyone !