Both of the functions are $.getJSON()
functions, and even though my first function is placed before the other one, it sometimes occurs after the second one. Note that I mentioned "sometimes". When I keep refreshing the page, I get different results, and it's like it's randomly being chosen which function is called first. Here is the snippet of code:
timeClusters = [];
$.getJSON('java_output/tasksTab.json', function (data) {
console.log ("first");
// Method stuff here, not important
});
$( document ).ready(function() {
console.log("second");
// Method stuff here, not important
});
Now, when I run the program and look at the console, sometimes I get
first
second
but other times I get
second
first
It is essential that I get the first one first, and second second, because the second method processes data that is produced and altered in the first method.
Let me know if you need more information