我将以下代码保存在.jspf文件中:
<!-- include library files -->
<script src="jquery.js"></script>
<script src="icanhaz.js"></script>
<script type="text/html" id="user">
Hello my name is {{ name }}
</script>
<script type="text/javascript">
$(document).ready(function () {
user_data_object = {name: "Michael"};
<!--
This should set user to the string 'Hello my name is Michael'.
However, ich.user is undefined, so when I make this call, I get the error:
TypeError: 'undefined' is not a function
(evaluating 'ich.user(user_data_object)'
-->
var user = ich.user(user_data_object);
});
</script>
为什么这不起作用?我测试过以确保正确包含jQuery和ich,它们是。如果我将此代码放在计算机上的.html文件中,它就可以了。但是,一旦我将它放在我的服务器上的.jspf文件中,它就会停止工作。有什么想法吗?