Twitch API isn't returning the part of the data I need

Hello everyone,

I’m working on my Twitch API app, and I made the following call to API:
$.ajax({
url: 'https://wind-bow.gomix.me/twitch-api/streams/monstercat?callback=?’,
datatype: ‘json’,
success: function(data) {
console.log(data);
console.log(data.stream);
}
});

The console log logs the data, but in a way that I haven’t seen before when I was working with other APIs. It starts like this: ‘/**/ typeof === ‘function’ &&’ .
This might be the reason why I can’t get a response when I try to log the data.stream value. Even though the ‘stream’ object exists in the data, it won’t log it to the console.

This is my CodePen: http://codepen.io/Yori1/pen/KWpPeE

I’ve been stuck with this problem for quite some time, so if someone could explain what’s up I would appreciate it.

I am seeing this error

Uncaught Error: Bootstrap’s JavaScript requires jQuery. jQuery must be included before Bootstrap’s JavaScript.

Why don’t you use the more reliable .getJSON call?

1 Like

.getJSON made it work, thanks a lot.

I assumed it wasn’t worth trying out .getJSON at first because it’s documentation says that it’s a shorthand version of this ajax function:

$.ajax({
dataType: “json”,
url: url,
data: data,
success: success
});

I guess .getJSON and ajax do different things somehow, though.

1 Like

Also for the Bootstrap error, just switch the order of the library references.

Went and fixed that too, I haven’t seen the error yet but this way I’m sure it will work for everyone.