首先获取信息,这是我来自服务器的响应
$response = array();
$i = 0;
while($result = mysql_fetch_assoc($query)){
$response[$i]["id"] = $result["ID"];
$response[$i]["post_date"] = $result["post_date"];
$response[$i]["post_content"] = $result["post_content"];
$response[$i]["nickname"] = $result["nickname"];
$i++;
}
echo json_encode($response);
似乎@k33g_org 方式确实有效,但现在控制台说我Uncaught ReferenceError: nickname is not defined
我的模板是
<script type="text/template" id="tplhome_post_list">
<div class="post">
<div class="view">
<p class="header_post">
<%= nickname %> - Le <%= post_date %>
</p>
<div class="statut">
<div class="like">
8
</div>
<div class="reply">
25
</div>
</div>
<p class="clear">
<%= post_content %>
</p>
</div>
</div>
</script>
怎么解决?定义模板值??