Currently working on the twitch tv project and I am having trouble since I am doing two AJAX calls and the data is not going into my variables at the right time it seems.
I have a function initUser() which is supposed to initialize the user by first running another function called getData() which basically gets the user’s offline data and assigns this data to the global object ****userObj. Then another function is run called onlineStatus() which checks if a user is currently streaming by checking if data.stream is null or not. Then finally $().append is used to display the data on the screen.
Problem is I am getting undefined for everything and I know that it has to do with the data from the AJAX request not getting back in time, maybe I’m wrong but it feels to be the case. I have been staring at the code for hours trying to figure this out or trying to refactor it without success.
Would appreciate any help.