0802
前台模板 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
本文首发于 炽(MyChy)个人主页 ,本文地址: http://www.jeanwen.com/blog/page/135
发表评论中......
关于精彩评论