I want to print information from data base. I am doing it in this way: I have global array of itmes. 1. function with ajax get request to server that fetch all records and put the records data in the global array. 2. function that prints the data from the global array.
var items = []
function initPage() {
getData(); / function that gets data from database and put in array
printData(); / function that prints data to html
}
My Question is: I am running this all in my computer so it is all running fast and I dont have issues. But if I will move all to the internet and the query will run slower, will I have issues with the printData function? May it run before getData will finish? Or it waits for getData to finish?
What is the best way to deal with this kind of situations?
Thanks Alon