首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JTemplate错误

JTemplate错误
EN

Stack Overflow用户
提问于 2011-11-21 16:41:05
回答 1查看 167关注 0票数 0

我想在我的php页面上使用JTemplate。我的模板:

代码语言:javascript
复制
<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调用:

代码语言:javascript
复制
<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>

来自Service.php的Json数据是正确的。但我得到以下错误:“无法读取属性‘长度’的未定义”我做错了什么?

EN

回答 1

Stack Overflow用户

发布于 2011-11-21 18:23:39

尝试:

添加

代码语言:javascript
复制
 $.ajax
            ({
               dataType:"json" , ...
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8209175

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档