次のcoffeescriptを使用してjsonをロードします
$.ajax jsonPath,
success : (data, status, xhr) =>
console.log("yea "+data)
this.currentIndex = 0;
this.imagesVO = data.images
this.imageManager = new ImageManager(data.images)
this.imagesCount = this.imagesVO.length
this.switchToImage(this.currentIndex)
error : (xhr, status, err) ->
$('#imageHolder').html("problem loading the json file, </br>make sure you are running this on your local server")
complete : (xhr, status) ->
#cconsole.log("comp")
jsonはそのままです
{
"showName": "aaa",
"galleryName": "Season 3 Preview",
"images": [
{
"title": "Les goes shopping for a new car",
"url": "images/hcp_stills-0.jpeg",
"description": "Sailboats on the Charles River"
},
{
"title": "Les goes shopping for a new car",
"url": "images/hcp_stills-1.jpeg",
"description": "Sailboats on the Charles River"
},
{
"title": "Les goes shopping for a new car",
"url": "images/hcp_stills-2.jpeg",
"description": "Sailboats on the Charles River"
}]
}
ローカルでテストするとき、このようにjsonから画像配列を取得し、それが機能します this.imageManager = new ImageManager(data.images)
ただし、サーバーでテストすると、jsonが正常にロードされていても、chromeはdata.imagesが未定義であると不平を言います。何か案は?