Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a template that looks like this:

<div class="users">
    <a class="username">{{ username }}</a>
    <br>
    <span class="age">{{ age }}</span>
</div>

I have an ajax request that comes in and returns something like this:

[{username: 'bob', age: 12}, {username: 'terry', age: 34} ... ]

I'm looking for a template engine that will just let me do this:

var elments = [];
$.each(ajax_result, function(obj) {
    elements.append(SomeTemplateEngine($("#my_template").text(), obj);
}
$("#some_container").append(elements);

Basically, I want to define my template in the HTML as a text node. And When I finish the rendering, I need to place it into the DOM. There are a bunch of javascript template engines out there, which one bets fits my needs?

share|improve this question
This should belong on stackoverflow. – Daniel Feb 15 at 1:46

closed as off topic by jmort253, World Engineer, Glenn Nelson, Walter, MichaelT Feb 15 at 3:55

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.