如何在JavaScript中从URL获取JSON?
2022-08-30 00:55:59
此 URL 返回 JSON:
{
query: {
count: 1,
created: "2015-12-09T17:12:09Z",
lang: "en-US",
diagnostics: {},
...
}
}
我试过这个,但它不起作用:
responseObj = readJsonFromUrl('http://query.yahooapis.com/v1/publ...');
var count = responseObj.query.count;
console.log(count) // should be 1
如何从此 URL 的 JSON 响应中获取 JavaScript 对象?