您好我是一个非常新的jQuery模板,我无法从远程文件夹中获取模板,但是当我使用内联模板时它工作正常。我的HTML是
<body>
<div class="container">
<div class="category_head">Heading..</div>
<div class="row">
<div id="category-video-container"></div>
</div>
</div>
</body>
现在我的模板文件是: _category.tmpl.html
<script id="categoryTemplate" type="text/x-jquery-tmpl">
<div class="col-sm-4 col-xs-6 col-md-3">
<div class="row">
<a class="videos_display" href="#"> <img src="${imgUrl}" />
<div class="xyz">${xyz}</div>
</a>
</div>
<div class="row">
<span class="title">${name}</span>
</a>
</div>
</div>
</script>
我的js文件是
var categories = [
{ name: "Anchorman 1: Fight Scene", xyz: '13:00', imgUrl: "assets/images/Desert.jpg" },
{ name: "Anchorman 2: Fight Scene", xyz: '13:00', imgUrl: "assets/images/Lighthouse.jpg" },
{ name: "Anchorman 3: Fight Scene", xyz: '13:00', imgUrl: "assets/images/Penguins.jpg" },
{ name: "Anchorman 4: Fight Scene", xyz: '13:00', imgUrl: "assets/images/Tulips.jpg" }
];
$.get("_category.tmpl.html", null, function(categoryTemplate) {
$(categoryTemplate).tmpl( categories ).appendTo( "#category-video-container" );
});
请帮忙