OK. My HTML looks like below.
<div id="json"></div>
<div id="content-placeholder">
<script id="some-template" type="text/x-handlebars-template">
<table>
<thead>
<th>col 1</th>
<th>col 2</th>
</thead>
<tbody>
{{#results}}
<tr>
<td>{{col_1}}</td>
<td>{{col_2}}</td>
</tr>
{{/results}}
</tbody>
</table>
</script>
</div>
And I am populating the above via Handlebar.js and the data is received from the server. Here s the code.
$.get(get_data_url, function(data)
{
$( #json ).empty().append(data);
var rows = eval( ( + data + ) );
var source = $("#some-template").html();
var template = Handlebars.compile(source);
$("#content-placeholder").empty().append(template(rows));
});
When the code runs the first time, it looks fine. But when I call the $.get the second time (and so forth), the template is not refreshed with the new data.
I also print out the whole data string in , to make sure that data is being refreshed from the server and it is.
When I check on my Chrome, it tells me "Uncaught TypeError: Cannot call method match of null".
Is it something to do with "compile"?