Displaying results from Javascript

Displaying results from Javascript

Hi there,

First, kinda new to jQuery and I'm stumble onto a nice script which i would like to try. (Javascript)
However, these guys who coded it talked a lot of jQuery and wrote a short note in the bottom:
The live.stream.preview variable contains a preview image of the stream it's checking ( the channel variable ), with those two all you need is a little jquery code to append it in an image tag to whatever element you want it to be inside on your page.


  1.  
           
    <head>
           
    <!-- Pulling jQuery from Google's servers, since most people already have it cached, the page loads faster -->
           
    <script type= "text/javascript" >
           
    document . write ( "\<script src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'>\<\/script>" );
           
    </script>
           
     
           
    <!-- Pulling the Twitch JS SDK from amazon because I'm lazy. You should get the newest one from github and host it yourself -->
           
    <script type= "text/javascript" src= "https://ttv-api.s3.amazonaws.com/twitch.min.js" ></script>
           
     
           
    <script type= "text/javascript" >
           
    $ ( document ). ready ( function (){
           
     
           
    // Now we initialize the SDK so we can actually use it
           
    Twitch . init ({ clientId : 'Your clientID Here' /* Replace this with your application's clientID from http://www.twitch.tv/settings?section=applications */ }, function ( error , status ){
           
    });
           
     
           
    // This is the list of streams you want to check the live status of
           
    var list = [
           
    'fire' ,
           
    'siglemic' ,
           
    'destructoid' ,
           
    'fpcforums' ,
           
    'towelliee' ,
           
    'oatavio' ,
           
    'draco'
           
    ]
           
     
           
    // Now we loop through the list of channels and check their statuses
           
    $ . each ( list , function ( index , channel ){
           
    Twitch . api ({ method : 'streams/' + channel }, function ( error , live ) {
           
    if ( live . stream == null ){
           
    // Stream is not live
           
    console . log ( channel + ' is not live' );
           
    } else {
           
    // Stream is live, live.stream.preview will be a stream preview image. Put it in a 16:9 container.
           
    console . log ( channel + ' is live, preview image: ' + live . stream . preview );
           
    }
           
    });
           
    });
           
    });
           
    </script>
           
    </head>
So, my quetion is how can I apply jQuery to display the results? Could anyone give me a start and point me in the right direction?

Thanks in advance!