Skip to content

Instantly share code, notes, and snippets.

@devdays
Created December 16, 2014 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devdays/06716ee2f26b17494fc9 to your computer and use it in GitHub Desktop.
Save devdays/06716ee2f26b17494fc9 to your computer and use it in GitHub Desktop.
Object JavaScript Load Data using jQuery and render using Mustache
<script src="Scripts/jquery-2.0.2.min.js"></script>
<script src="Scripts/mustache.js"></script>
<script>
var data = {};
$.getJSON(
"Data/products.txt",
function (d) {
data = d;
var template = $("#productTmpl").html();
var html = Mustache.to_html(template, data);
$('#sampleArea').html(html);
}
);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment