Created
March 3, 2012 22:40
-
-
Save stanpalatnik/1968728 to your computer and use it in GitHub Desktop.
Dust.js Client side
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
<html> | |
<head> | |
<script src="dust-full-0.3.0.min.js"></script> | |
<script type="text/javascript"> | |
//example showing client-side compiling and rendering | |
var compiled = dust.compile("Hello {name}!", "index"); | |
dust.loadSource(compiled); | |
dust.render("index", {name: "David"}, function(err, out) { | |
if(err!= null) | |
alert("Error loading page"); | |
//assume we have jquery | |
$("#pageContainer").html(out); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="pageContainer"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment