Need help with Twitch tv project

Need help with Twitch tv project
0.0 0

#1

I am stuck for hours and currently have no idea why the assignment of channel names as property to objects is not working,
see getjson section of my javascript section and review my code for channel name assignment to channels object.
my project link is http://codepen.io/AronStone/pen/qadmkz?editors=0011
and i have made a tester version by clearing css and adding console log here http://codepen.io/AronStone/pen/XjbazV?editors=0011
Thanks in advance.


#2

Hi,

First of all, you have the same error in different places in you code.

Lines 8, 16, 25, you wrote this var html=; Replace it by var html="";

Secondly, you don’t access the data object properties correctly.

The ajax returns an object. Here how you can run tests against it :

  • check if the stream property is not undefined. If it is, then the account is either closed or doesn’t exists. You can then check the status if you want.

  • If the stream property is not null, the fun can begin

  • stream.channel.display_name returns the name of the channel

  • stream.channel.logo returns the logo of the channel

  • stream.viewers returns the current number of viewers

You are almost done. My advice is to search to know how is the data object structured. You can use an online json parser to help you see through.

Good luck.


#3

Evntually figured these things myself,it is for the good i guess.
Thanks for giving such descriptive solution to my messy code.