Question: I'm very new to js and jQuery, pardon my bad code. Trying to dynamically generate a formatted table of YouTube thumbnails/urls from a keyword query. Thumbnails need to be wrapped in an tag with fancybox class settings to trigger a fancybox player. I'm setting all the necessary 'a' and 'img' tags as vars and just trying to parse the JSON feed for video IDs, plug those into the url and thumbnail templates and then generate a table that starts a new row of thumbs after every 9 cells.

Here's my code. Right now it only generates a single column and keeps repeating the same IDs and adding a new one every iteration. Any help is hugely appreciated!

```
<script type="text/javascript">

    var vidCell1 = '<a class="fancybox-media" href="https://www.youtube.com/watch?v=';
    var vidCell2 = '"><img src="http://i.ytimg.com/vi/';
    var vidCell3 = '/hqdefault.jpg" width="100" alt="" /></a>';
    var mytablebody = '<tbody><tr>';
    var ti;
    var id;

    $.getJSON("https://gdata.youtube.com/feeds/api/videos?q=mirthkon&v=2&alt=jsonc",function(youtubeJSON) {

        ti = youtubeJSON.data.totalItems;    
        for (var i=0; i<=ti; i++) {            
            id = youtubeJSON.data.items[i].id;
            mytablebody += "<td>" + vidCell1 + id + vidCell2 + id + vidCell3 + "</td>";
            mytablebody += "</tr></tbody>";
            $('.thumbs').append(mytablebody);
        };    
    });​
</script>
</head>
<body>
    <table class="thumbs" width="100" height="100" border="2" cellpadding="0" cellspacing="0"></table>​
</body>

```

Answer: 
Finally found a small trick to make it work. Add the following VM option to the execution parameters (Run Config/Debug Config)

```
-Djline.terminal=jline.UnsupportedTerminal

```

This will make the code run inside Eclipse. However, some strange characters may be written to the console during the course of the run.

Hope this helps.
If you are using [picocli with jline2](https://github.com/remkop/picocli/tree/master/picocli-shell-jline2).

You can delegate the heuristic to picocli which seems better than the jline2 heuristic (instead of using `-Djline.terminal=jline.UnsupportedTerminal`)

The code can looks like :

```java
// JLine 2 does not detect some terminal as not ANSI compatible, like Eclipse Console
// see : https://github.com/jline/jline2/issues/185
// So use picocli heuristic instead :
if (!Help.Ansi.AUTO.enabled() && //
          Configuration.getString(TerminalFactory.JLINE_TERMINAL, TerminalFactory.AUTO).toLowerCase()
                 .equals(TerminalFactory.AUTO)) {

     TerminalFactory.configure(TerminalFactory.NONE);
}

```

(see <https://github.com/jline/jline2/issues/185>)