Search code examples
jqueryapitwitch

Can't get Twitch API stream object


This is my script, which I've attempted to put together from researching the questions here and the Twitch API documentation.

$.getJSON("https://api.twitch.tv/kraken/streams/marcusraven86&callback=?", function (data) {

console.log(data);

});

All I'm trying to accomplish is to log the object that is returned so I can look through it and see what's there. Instead of a logged object, I get an error in the console with this:

GET https://api.twitch.tv/kraken/streams/marcusraven86&callback=jQuery1113006526092323474586_1435680266323?_=1435680266324 

Any thoughts on what might be going on? I'm new to the Twitch API, and all I want to do is check out what's returned from my stream.


Solution

  • Try formatting it like this:

    $(document).ready(function() {
        $.getJSON('https://api.twitch.tv/kraken/streams/marcusraven86?callback=?', function(data) {
            console.log(data);
        });
    });
    

    JSFiddle