我正在使用 Jquery 来获取一个 json 文件,并且在浏览器中出现错误(意外的令牌:)
这是我的javascript:
fetchScenes: function() {
$j.ajax({
crossDomain:true,
url: 'xml/scenes.json',
dataType: "jsonp",
success: function( sceneXML ) {
}
});
},
这是我的json的部分结构:
{ "scenes": {
"scene": {
"-id": "0",
"-name": "Master",
"scene": [
{
"-id": "1",
"-name": "Weekday Vehicle",
"-description": "Your home away from home.",
"scene": [
{
"-id": "10",
"-name": "For My Commute",
"scene": [
{
"-id": "13",
"-name": "Heading to School",
"scene": [
{
"-id": "20",
"-name": "Style Seeker",
"-vehicles": "1,3,6"
},
{
"-id": "21",
"-name": "Creative Thinker",
"-vehicles": "9,0,3"
}
]
},
我用 JSONLint 验证了 JSON,所以我不确定问题是什么。