亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何使用更新的JSON / API密鑰數據鏈接圖像并將其顯示到HTML網頁

如何使用更新的JSON / API密鑰數據鏈接圖像并將其顯示到HTML網頁

慕工程0101907 2021-05-12 13:14:52
在為一個有趣的項目工作時,我遇到了一些麻煩?,F在,該項目的主要功能就是每天通過API密鑰展示一條太空探索新聞。文字效果很好,但是我無法弄清楚每天如何放置在正確的圖片中。我嘗試使用XMLHttp請求以及使用字符串在外部顯示數據來調用它。我覺得我缺少明顯的東西。當前的JSon在這里,它是HDURL,我想在每次更新時不斷調用它,以使查看器不會停留在一個圖像上:{"copyright":"Devin Boggs","date":"2019-05-11","explanation":"The Milky Way doesn't look quite this colorful and bright to the eye, but a rocket launch does. So a separate deep exposure with a sensitive digital camera was used in this composite skyscape to bring out our galaxy's central crowded starfields and cosmic dust clouds. In the scene from Merritt Island National Wildlife Refuge, a nine minute long exposure begun about 20 minutes after the Miky Way image recorded a rocket launch and landing. The Falcon 9 rocket, named for the Millennium Falcon of Star Wars fame, appropriately launched a Dragon resupply ship to the International Space Station in the early morning hours of May the 4th. The plume and flare at the peak of the launch arc mark the rocket's first stage boost back burn. Two shorter diagonal streaks are the rocket engines bringing the Falcon 9 stage back to an offshore landing on autonomous drone ship Of course I Still Love You.","hdurl":"https://apod.nasa.gov/apod/image/1905/crs17spaceXboggs.jpg","media_type":"image","service_version":"v1","title":"Milky Way, Launch, and Landing","url":"https://apod.nasa.gov/apod/image/1905/crs17spaceXboggs1024.jpg"}JS在這里:var header = document.querySelector("header");    var image = document.querySelector("images");    var section = document.querySelector("info");    var div = document.querySelector("misc");    var requestURL = "https://api.nasa.gov/planetary/apod?api_key=yoCLrO1qrJoLzGQx3yNNL2OWgey7e7s7aTEGj5PK";    var request = new XMLHttpRequest();    request.open("GET", requestURL);    request.responseType = "json";    request.send();    request.onload = function() {      var loveSpace = request.response;      populateHeader(loveSpace);      showKnowledge(loveSpace);    }我的預期結果是顯示所有數據,而不僅僅是文本信息。任何和所有的想法表示贊賞。謝謝您的幫助!
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 137 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號