在加载网页时,微调器应该在浏览器中停止,但它不会继续旋转,我该如何阻止它。
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<script type="text/javascript">
var requestURL = "https://newsapi.org/v1/articles?source=techcrunch&sortBy=top&apiKey=045089075bc74354be01b34f6335d32b";
var request = new XMLHttpRequest();
request.open('GET',requestURL);
request.responseType = 'json';
request.send();
request.onload = function() {
var myjsondata = request.response;
console.log(myjsondata);
showdata(myjsondata);
}
function showdata (data) {
var str = data.articles[0].title;
document.write(str + "<br> <br>");
var img = data.articles[1].description;
document.write(img);
}
</script>
</body>
</html>
您可以查看此图片 - &gt;