我正在使用DreamHost制作一个简单的网站,以进行Web开发最终评估,但我一直无法使手柄正常工作。我不知道我的代码是否有问题,或者DreamHost中是否有需要激活的设置,或者还有其他问题?
<!DOCTYPE html>
<html>
<head>
<title>Test Handlebars</title>
<meta charset="utf-8"/>
<style type="text/css">
.handlebars {
display: none;
}
</style>
<script src="https://code.jquery.com/jquery-2.1.3.min.js" > </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/3.0.1/handlebars.min.js"> </script>
<script>
var show_data_url = "https://bostonstudentrush.com/showlist.json";
$(document).ready(function(){
$.getJSON(show_data_url,
function (data) {
var mysource = $('#showlisttemplate').html();
var mytemplate = Handlebars.compile(mysource);
var myresult = mytemplate(data)
$('#showlistlist').html(myresult);
});
});
</script>
</head>
<body>
<h2>Handlebars</h2>
<div id="showlistlist">This week’s shows:<div>
<div id="showlisttemplate" class="handlebars">
<ul>
{{#showlist}}
<li>{{showname}}</li>
{{/showlist}}
</ul>
</div>
</body>
</html>