我似乎无法弄清楚如何让这段代码工作。我试图访问这个json片段中的'Name'对象。任何帮助,将不胜感激。访问JSON数组中的对象时遇到问题
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">
</script>
<script>
$(document).ready(function() {
\t $.getJSON('https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22AAPL%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=', function(data) {
\t $('#demo').text(data[0].Name);
});
});
</script>
</head>
<body>
<p id="demo"></p>
</body>
</html>
请提供实际的JSON的问题本身就是一个样本。可能有人可以帮助您,但无法访问API网址。 –