【发布时间】:2012-05-25 00:54:31
【问题描述】:
我正在使用 json 来获取请求。我的响应对象格式是:
[
{"id":3,"name":"Zuned Ahmed"},
{"id":4,"name":"ZunedTWO"},
{"id":7,"name":"TORCH"}
]
ajax 调用是:
$.ajax( {
type : 'GET',
url : URL,
async : false,
dataType : "json",
success : function(data) {
$("#product_data_div").html($("#product_template").tmpl(data));
}
});
模板代码为:
<div id="product_data_div">
<script id="product_template" type="text/x-jquery-tmpl">
<input type="checkbox" id="product_${id}" name="" value="${id}" class="margin-top10">
<label for="product_${id}" class="margin-top10">${name}</label>
<div class="clear"></div>
</script>
</div>
数据未显示,3 个复选框显示但没有文本。
谁能帮我找出变化。
【问题讨论】:
-
谁能提供一些我哪里出错的建议。提前致谢。
标签: jquery-templates