Skip to content

Instantly share code, notes, and snippets.

@mgroves
Created June 6, 2014 01:49
Show Gist options
  • Select an option

  • Save mgroves/fc9c787fbb94bc4e814a to your computer and use it in GitHub Desktop.

Select an option

Save mgroves/fc9c787fbb94bc4e814a to your computer and use it in GitHub Desktop.
<script src="~/Scripts/jquery.js" type="text/javascript"></script>
<script src="~/Scripts/doT.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var template = $("#my-dot-template");
var dotted = doT.template(template.html());
// I'm building up an object here with literals
// but typically this data would be returned by an ajax request
var data = {};
data.Name = "Matthew D. Groves";
data.City = "Funkytown, USA";
data.ShoeSize = 13;
$("#output").html(dotted(data));
});
</script>
<div id="output"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment