Created
November 14, 2012 02:02
-
-
Save planetoftheweb/4069805 to your computer and use it in GitHub Desktop.
Finished Mustache.js Example
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Mustache Sample</title> | |
</head> | |
<body> | |
<h2>Titles</h2> | |
<ul id="talktitles"> | |
</ul> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.7.0/mustache.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
<script id="speakers-template" type="text/template"> | |
{{#speakers}} | |
<li>{{title}}</li> | |
{{/speakers}} | |
</script> | |
<script> | |
$(function() { | |
$.getJSON('http://barcampdeland.org/_/data/speakers.json', function(data) { | |
var template = $('#speakers-template').html(); | |
var info = Mustache.to_html(template, data); | |
$('#talktitles').html(info); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment