【发布时间】:2014-02-01 16:48:17
【问题描述】:
我正在使用 mvc4 web api 项目并想在同一页面上bind three different div。
Detail.cshtml
$.getJSON(
"/api/GroupDetailValue/" + id,
function (data) {
$.each(data, function (index, value) {
if (value.Id != undefined) {
$("#GroupTemplate").tmpl(value); //I did like this to set all values to following div
}
});
<script id="GroupTemplate" type="text/html">
<div class="container">
<div class="span12">
Name</div></div>
<div class="container">
<div class="span8">
Memeber List</div></div>
<div class="container">
<div class="span3">
Address </div></div>
</script">
没有设置值:( 出现运行时错误:
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'tmpl'
【问题讨论】:
-
绑定是什么意思?
-
我的意思是说`函数(数据)`中有水数据,我需要分别在所有
<div>上显示。
标签: jquery css asp.net-mvc asp.net-mvc-4 asp.net-web-api