我似乎無法弄清楚如何讓這段代碼工作。我試圖訪問這個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網址。 –