Without using Jquery, Do you mean something like this?
<script>
var my_data_store=[];
var count_sucess=0;
var num_ajax_object=0; //counter for how many request object you create
// YOU CAN RUN FUNCTION LIKE THIS IN LOOP OR ANY WAY YOU PREFER
// AND POPULATE YOUR my_data_store
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
my_data_store.push(xmlhttp.responseText);
count_success++;//increase the counter
}
}
xmlhttp.open("GET","............",true);
xmlhttp.send();
***********************************************
//DON'T DON THIS!!
//THIS WON'T WORK BECAUSE THE CALL IS ASYNCHRONOUS
// AND YOU MIGHT END UP GETTING undefined
my_data_store.push(xmlhttp.responseText);
***********************************************
}
</script>
function assigned to xmlhttp.onreadystatechange will only be executed AFTER you receive response from your AJAX request thus you can automatically store the data in this way.
How to know if all data has arrived?
You can count how many ajax request you sent easily (I did not write any code for that because implementation might be different). As in above code, you can have something like:
if(num_ajax_object==count_sucess){
//DO YOUR PROCESSING NOW
}
Remember though, this do not take into account if the request fails. You might want to add try/catch and only take into account the number of successful requests and success_count.