私はjavascriptテンプレートにjQoteライブラリを使用しています。以下はajaxリクエストからのJSONレスポンスです
{"Person":[{"actor_image":"Image1","actor":"Name1"}]}
以下はjQueryコードです
$(document).on('click',".notifications",function(){
$("#notificationRegionWrapper").toggle();
$.ajax({
type: 'post',
url: "/async/getnotificationfeed",
dataType: 'json',
async:false,
success: function(res) {
var dataJson = $.parseJSON(res);
$('#users').jqotesub('#template', dataJson);
}
});
});
そしてここで私はオブジェクトを出そうとしていますが、エラーが私にこれを与えています
.Person is undefined
これは、オブジェクトを反復処理したいので、オブジェクトを出力しようとしている方法です
<table id="users">
</table>
<script type="text/html" id="template">
<![CDATA[
<tr>
<td class="title"><%= this.Person.length %></td>
</tr>
]]>
</script>