In my .hbs delivered by my node server:
<script src="/javascripts/handlebars.min-latest.js"></script>
<script id="entry-template" type="text/x-handlebars-template">
<div class="entry">
<h3>{{title}}</h3>
<div class="body">
{{body}}
</div>
</div>
</script>
In my client-side javascript file:
var source = $("#entry-template").html();
var template = Handlebars.compile(source);
var context = {title: "My New Post", body: "This is my first post!"};
var html = template(context);
console.log(html);
My output:
<div class="entry">
<h3></h3>
<div class="body">
</div>
</div>
Basically, even with the simplest example on their frontpage, it isn't working. Is it because I'm using handlebars on the front and back end? If so, how can I go around that?
Add
$('body').append(html);to you script:Fiddle Demo