0
我想在我的php頁面上使用JTemplate。我的模板:JT模板錯誤
<script type="text/html" id="TemplateResultsTable">
{#template MAIN}
<table cellpadding="10" cellspacing="0">
<tr>
<th>Seller</th>
<th>Bid Amount</th>
<th>Date</th>
</tr>
{#foreach $T.d as CD}
{#include ROW root=$T.CD}
{#/for}
</table>
{#/template MAIN}
{#template ROW}
<tr>
<td>{$T.Bidder}</td>
<td>{$T.Bid}</td>
<td>{$T.BidDate}</td>
</tr>
{#/template ROW}
</script>
我的Ajax調用:
<script type="text/javascript">
$.noConflict();
jQuery(document).ready(function($) {
$('#ctl0_Main_BidHistoryPortlet_ctl0').click(function(){
$.ajax
({
type: 'POST',
url: '/index.php/page,Service',
data: 'action=TestFunction&AuctionId='+$('#ctl0_Main_BidHistoryPortlet_AuctionId').val(),
success: function(msg)
{
ApplyTemplate(msg);
}
});
});
function ApplyTemplate(msg)
{
$('#Container').setTemplate($("#TemplateResultsTable").html());
$('#Container').processTemplate(msg);
}
});
</script>
JSON數據是來自Service.php是正確的。但我得到以下錯誤: 「無法讀取未定義的屬性」長度「 我做錯了什麼?
當我添加數據類型: 「JSON」 我得到以下錯誤 「無法讀取的未定義的屬性 'd'」 –