码迷,mamicode.com
首页 > Web开发 > 详细

JTemplates + $.Ajax

时间:2017-08-17 20:08:29      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:tco   function   cli   agent   需要   gettime   long   new   方式   

只需要改列名即可 :<script type="text/template" id="foreach">   里的循环

{$T.record.列名}

 


<script src="~/Js/jquery-2.1.0.js"></script>
<script src="~/Js/md5.js"></script>
<script src="~/Js/jquery-jtemplates.js"></script>
<script type="text/javascript">

    function Test3() {
        alert(new Date().getTime());
        $.ajax({
            type: "post",    //请求方式
            url: "BaiLong/GetTravelAgencyList",
            success: function (data) {
                //绑定为json对象
                var da2 = JSON.parse(data);
                $(‘#myistrue‘).setTemplate($(‘#foreach‘).html()).processTemplate(da2);
            }
         
        });



    }




</script>

<script type="text/template" id="foreach">   
        {#foreach $T.AgentList as record begin=0}  
        <tr>  
            <td>{$T.record.nAgentID}</td>  
            <td>{$T.record.sAgentCode}</td>  
              <td>{$T.record.sCommission}</td>  
        </tr>  
        {#/for}  
     
     
    
</script>



<body>
      <table>  
    <thead>  
        <tr>  
            <td>Age</td>  
            <td>First?</td>  
            <td>Last?</td>  
        </tr>  
    </thead>  
    <tbody id="myistrue">  
    </tbody>  
</table>
    <section class="featured">
        <button onclick="Test3()">调取旅行社列表</button>
    </section>
</body>

JTemplates + $.Ajax

标签:tco   function   cli   agent   需要   gettime   long   new   方式   

原文地址:http://www.cnblogs.com/j2ee-web-01/p/7383792.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!