【发布时间】:2011-07-09 14:43:50
【问题描述】:
我收到“Uncaught SyntaxError: Unexpected token
请帮忙。
<script type="text/javascript" src="/static/jstree/_lib/jquery.js"></script>
<script type="text/javascript" src="/static/jstree/jquery.jstree.js"></script>
<script type="text/javascript">
$(function () {
// load the 3D Script
$("#container").ready(function(){
$.getScript("json_model.js");
});
// load the jstree
$("#demo").jstree({
"json_data" : {
"ajax": {
"url": "/static/templates/json_tree.js",
"data":function(n){
}
}
},
"plugins" : ["themes", "json_data"]
}).bind("select_node.jstree", function (e, data){});
});
</script>
<div id="demo">
</div>
<div id="container">
</div>
【问题讨论】:
-
我的猜测是它在你的
json_model.js文件中,因为当你注释掉它的加载时,它工作正常。可以发json_model.js的内容吗? -
错误在哪一行?
json_model.js中有<script>标签吗?删除它们。 -
只是猜测:您/您的脚本可能正在尝试加载它期望包含 JSON 的文件。相反,它正在获取 HTML(可能是 404 错误)。
标签: javascript jquery html