APIを呼び出して、jsonオブジェクトを返すと、コンテンツでいっぱいのdivが大量に生成されます。しかし、私はオブジェクトのプロパティを挿入するために連結を使い続けています。それへのより良い方法はありますか?
$.each(JSON, function(key, value) {
var content = display_mention(value);
$("#mentions_container").append(content);
});
function display_mention(mention) {
//this str will be much more complex and use lots of concatenation
var str = "<div data-id='" + mention.id +"'> " + mention.texto + "</div></br>";
return str;
}