I am having trouble generating html code from jqavascript/jquery in a html template rendered in django. I have to append html code and also insert some values in between. Right now I am doing a crude string append like this
var features =['a','b']
for (var i=0;i<features.length;i++){
var html_code = "<div class = 'feature' <h2>"+features[i]+"</div>
$("#features").append(html_code)
}
For html code
<div id="features"></div>
What is the right and cleanest way to do this. I know templating is the way to go but there seem to be so many different ways - inline javascript, external library like mustache,handlebar, using django's own template solution - it's very confusing