<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>X.js</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
        <ul class="list"></ul>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script src="X.js"></script>
        <script>

        new X.Collection({
            url: 'http://apis.is/flight?language=en&type=arrivals',
            fetched: function() { addToView( this ); },
            format: function ( res ) { return res.results; }
        }).fetch();

        function addToView ( flights ) {
            $('.list').before([
                '<h1>Count of flights: ' + flights.count() + '</h1>',
                '<p>Sótt af: <a href="' + flights.url + '">' + flights.url + '</a></p>'
            ].join(''));
            flights.each(function( flight ) {
                $('.list').append('<li>' + flight.get('date') + ' - ' + flight.get('to') + '</li>');
            });
        }

        </script>
    </body>
</html>

Add a demo for anyone to play around with
Add a demo for anyone to play around with
