Yesterday I finished the last intermediate front end project – the TwitchTV API App!
The main things I learned, or hurdles I faced from this project are —
- Getting logo and status of the Twitch TV accounts regardless of if they are online or offline. If an account is offline, the default API url suggested by FCC won’t work. I found another URL to get general information for accounts that are offline.
- Learning the JQuery apend/prepend/after methods. The main task is, after using the getJSON method to get the account status, upon “document ready”, add these elements to the html — I used the JQUERY after method for this.
- Learning how to use the “for loop” together with getJSON. This has taken me lots of time – because of the asynchronous nature of getJSON, initially my username and status will show up randomly, or repetitively in my html. I learned to use for each i, function(i), to make sure that each i functions “locally” within the getJSON for loop.
- check out this stackoverflow post – after millions of searches, this one saved my life! https://stackoverflow.com/questions/15347750/getjson-and-for-loop-issue
- Learned how to turn status, and logo into “variables”, to use the same URL structure in the for loop. This is the first time I’ve used used “variables” to streamline my JS functions – very efficient!
After these four intermediate projects, I feel much more competent and confident in the JQuery methods, and working with APIs! Now onto my intermediate scripting challenges!