Object JavaScript Load Data using jQuery and render using Mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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