Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Object JavaScript - Mustache + jQuery
<!DOCTYPE html>
<div class="main-content">
<h1>All Products</h1>
<div id="sampleArea"></div>
<script id="productTmpl" type="text/template">
<li>{{name}} {{category}} {{price}}</li>
<script src="Scripts/jquery-2.0.2.min.js"></script>
<script src="Scripts/mustache.js"></script>
var data = {};
data.products = {};
function (d) {
data = d;
var template = $("#productTmpl").html();
var html = Mustache.to_html(template, data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment