Help Twitch API [Javascript Asynchronous Requests]

Hello campers,
I have been having problem with asynchronous requests in the Twitch API project. I have been able to request the website and get its data. However, I am trying to update a global variable inside an asynchronous request and is not working well. I would be really glad if someone could help me with it.

I was trying to experiment with $(document).ready(function(){} as I thought that maybe the asynchronous function would update the variable and just then the code inside $(document).ready(function(){} would be executed.

The copy and paste parts are from another project that i asked for a camper here in the forum to help. Since I understood his code but was afraid of changing it I copied from the other project and made just the necessary changes,

  1. When the app loads, its going to show the twitchers that are already in the array all in separate boxes with Online/Offline and the game currently played.

  2. Add twitch channel is going to add a new twitcher to the array. This will reload the page with the separate boxes of the standard array + the chosen twitcher. This is going to be displayed below the search bar in the div with the id “results”.

By the way, the library was a failed attempt to control the asynchronous requests. But it failed miserably, and I forgot to take it out of the code.