我在 WinJS 中为 Windows 8 Metro 应用程序调用 Flickr 数据馈送。当我尝试使用 JSON.parse 解析提要响应时,我收到了 Invalid Character 错误。这是我的代码:
function processPhotos(result)
{
var photoData = JSON.parse(result.responseText);
//bind here
data.items.forEach(function (item) {
list.push(item);
});
}
function processError(error) {
console.log(error.message);
}
WinJS.xhr({ url: "http://api.flickr.com/services/feeds/photos_public.gne?format=json" }).then(processPhotos, processError);
WinJS.Namespace.define("data", {
items: groupedItems,
groups: groupedItems.groups,
getItemsFromGroup: getItemsFromGroup
});
Result.ResponseText 具有预期的内容。
有没有其他人遇到过这个?