I am having a bit of a problem right now. I try using a global array and store information to it in one function and try to use the information inside it in another function, but when I try to access the info, it appears as empty, even though I call the function before accessing the information. Here is an example code:
var myArray = [];
functionThatLoops(parameter_Array, parameter2){
    for (item in parameter_Array){
        $.get(URL,
        {
            method: "endPointMethod",
            id: item["ID"]
        }, function(data){
            myArray.push(data)
        });
    }
}
mainFunction(){
    c = 1;
    for (array in AnotherMultiDimensionalArray){
        functionThatLoops(array,c);
    }
    console.log(myArray) //Displays Array with correct number of elements and correct info
    console.log(myArray.length) //Displays 0 and after this array appears to be empty
    for (item in myArray){ //Nothing prints out in this loop, as array appears empty
        console.log(item)
    }
}
What could be the problem? It looks like the code that fills the array is executing last...
