First time, need help!

This is my first time working with an api and JavaScript.
I have previous experience in Python so JS wasn’t that foreign to me but I still need a little help!
I have spent the last few days reading through all the information I can to make my script on my own but I guess it’s time to ask smarter people.

My goal is to pull data from , get data from only the first stream in the list/array/whatever-it-is (I’m still unsure what I’m looking at. They’re objects in a list, correct?), and then embed the player from that stream. I have the general concept in my head but don’t know exactly where to start.

Here is the structure I have so far. A little guidance would help a lot!

I guess what I’m trying to ask is:

  1. how the GET command is used to get the data
  2. how to parse/pick out the data that I want

Since you’re using jQuery, take a look at jQuery.ajax with the jsonp dataType. Jsonp has to be used because the Twitch API doesn’t allow cross-origin requests. The callback function will get a decoded json object that you can then inspect in the browser’s dev tools.

So, I understand the request to get the decoded json object. I’m having difficulty trying to weed out the specific data I want. Also, is there a way to request the data I receive then print it on the webpage? Doing so would help me troubleshoot my problems.

Use the console to test and debug your JavaScript:

Okay, I debugged to another point where I need help. The ajax call I make succeeds,
but now how do I cache or store the JSONdata I received into a variable?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.