我有一个 JS(data.js) 文件,其中的数据为
var Content = {
Page1: {
Tiles: [
{ "id": "1",
"className": "home-test-class",
"tileType": "widget",
"tileColor": "red",
"Bookmark": : {
"Icon": "iconset",
"Class": "dummytext",
"Content": "Dummy Content",
"URL": ""
},
"Tile": false,
"SmallWidget": false,
"Widget": false
},
{
"id": "1",
"className": "title-class",
"tileType": "widget",
"tileColor": "red",
"Bookmark": false,
"Tile": false,
"SmallWidget": false,
"Widget": false
},
]
}
}
我创建了一个 INIT 方法来使用这些数据
Init = function () {
$.ajax({
url: 'scripts/data.js',
dataType: "json",
contentType: 'application/json; charset=utf-8'
}).done(function (data) {
$.doTimeout(1000, function () {
console.log(data);
LoadViewData(data);
});
}).fail(function (request, error) {
//Handle Failures here.
alert('Error' + error);
});
ko.applyBindings(this);
},
它给了我一个 JsonParse 错误。
我正在使用敲除将数据绑定到 UI。当我使用 Fiddler 并检查响应时,它说“所选响应不包含 vaid JSON 文本
请让我知道我该如何解决。