rgsoto
December 14, 2017, 2:41pm
1
Right now, I have a toggle button that’s gray for each twitch user, What I would like to do is remove the toggle, if that user is playing a game.
So something like this: If data.stream.game == true, remove gray toggle button;
I don’t know where to do this in my code or how.
Codpen: https://codepen.io/rgsoto/pen/aVRJYp?editors=1111
Checking your console, you have a problem with the way you are using the data value on line 18:
console.log(data.links[0]);
Take a look at your data object:
You have a typo with links, and is links an array? Here is what it should be:
console.log(data._links.self);
rgsoto
December 15, 2017, 6:35pm
4
Awesome, thank you! I knew creating three separate ajax calls violated the DRY principle bout couldn’t think of another way to do it. Your suggestion is great and much appreciated.
rgsoto
December 15, 2017, 6:36pm
5
Thanks Isaac! I’ll update my code.