« [转载]ASP.NET MVC中你必须知道的13个扩展点 星星评分系统 jQuery.Raty »

前台模板 Json格式化显示 jquery.tmpl

  • 分类:
  • 评论:0
  • 浏览:742

基本功能

$.tmpl( "<li>${Name}</li>", { "Name" : "John Doe" }).appendTo( "#target" );

高级功能

 $.ajax({
    url: url,
    cache: false,
    type: "POST",
    dataType: "json",
    data: { "cont": cont },
    success: function (jsonDate) {
      if (jsonDate.success == 1) {
        $("#message_list").children().first().before($('#commentTemplate').tmpl(jsonDate));
    }
  });


HTML
<script id="commentTemplate" type="text/x-jquery-tmpl">
 <div class="messagecontent_div" id="${Msgid}ReplyShow" Replyfi="${Msgid}">
 </div>
</script>
地址:https://github.com/jquery/jquery-tmpl

github.com/jquery/jquery-tmpl


本文首发于 炽(MyChy)个人主页 ,本文地址: http://www.jeanwen.com/blog/page/135

相关文章  

关于精彩评论  

发表评论
发送中发表评论中......