Help with my FreeCodeCamp Twitch.tv app

javascript

#1

Hi everyone,

Sorry if newbies’ requests for help aren’t allow here, but I’ll just go ahead and post it.
I’m doing FreecodeCamp and right now I’m at intermediate front end projects.
I’ve been stuck for weeks on my Twitch TV app. I’ve been reading more about events, JSON and JQuery but I’d like to finish it as soon as possible because I want to move on to the next algorithms challenges.
So here’s what I have done so far. Bear in mind I’ve done it pretty much by myself: I didn’t look at any code and I just use what we learn in FCC (that wan’t a lot) and my own research online.

It basically doesn’t work properly. The channels don’t always show the status, sometimes you refresh the page or do whatever and the last 4 don’t show the status.
The online/offline buttons don’t work.
Ignore the CSS, that’s my strong suit so I always leave it for last. The only CSS I added was just to visualize better.
Can you please give me a hand here? I don’t want you to rewrite my code, just point me in the right direction: where am I getting something wrong and what can I read up on to figure out how to fix it.
All the other projects where fairly easy but this one is blowing my mind for some reason and I’ve become stuck. I’m eager to move along with FCC!

Thank you all so much in advance!!

Cheers,
Virginia


#2

Hi Virginia, this is a totally acceptable request :slight_smile:

When I was doing FCC I skipped ahead whenever I got stuck, sometimes changing topics or focusing on something else for a while will help you work through problems.

I’m not sure about the intermittent online status issues, but I might be some help.

On line 12 your are closing the loop over the list of user names, so the click handlers do not have access to the variable i.

If you are interested I am happy to share my solution as well.


#3

Thanks so much!!
I think I fixed that. Got rid of jQuery and did everything with ajax:

but my problem is that all the streams return “null”, and I tried with channels that are streaming right now and I keep getting “null”! What am I doing wrong?


#4

When I run it right now, I see a populated list of channels and statuses - no nulls! Is this still not working for you?

Addressing why your buttons aren’t working:

You need to tell them to do something! This is done by attaching an event handler in your JavaScript code. Here’s the documentation for adding event handlers with jQuery: http://api.jquery.com/on/

There are examples down the page that show how to select an element, give it an event to listen for, and a function to execute when it hears that event.