pillarjs / hbs

Express view engine wrapper for Handlebars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use ajax

953133667 opened this issue · comments

I need use ajax async update my page.

The web page template code is:

<script id="j-wenews-tmpl" type="text/x-handlebars-template">
{{#each result.list~}}
<tr>
<td>{{~firstImg}}</td>
<td>{{~id}}</td>
<td>{{~mark}}</td>
<td>{{~source}}</td>
<td>{{~title}}</td>
<td>{{~url}}</td>
</tr>
{{~/each}}
</script>

The web page javascript code is:

//More code
var source = $("#j-wenews-tmpl").html();
var template = Handlebars.compile(source,json);
var html = template(res);
//More code

OK! after hbs compile.I get this template code.

<script id="j-wenews-tmpl" type="text/x-handlebars-template">
</script>

Look at, after hbs compile,I geted an empty string.

image

Please help me , thank you.