i use Mustache.js succusefully display the html ,here’s the code
var mygame = {
player:'viking',
games:[{name:'d1',type:'avg'},{name:'cod7',type:'fps'},{name:'war3',type:'rts'}]
};
var template = '{{player}} is a good guy<br/> <ul>{{#games}}<li>name:{{name}} and type:{{type}} </li>{{/games}}</ul>';
var html = Mustache.to_html(template, mygame);
var con = document.getElementById('container');
con.innerHTML = html;
but how do i use it when the object is a array ,like
var mygames = [{name:'d1',type:'avg'},{name:'cod7',type:'fps'},{name:'war3',type:'rts'}];
Try this: