加载网页微调器(加载)不会在浏览器选项卡中停止?

时间:2017-06-11 06:55:17

标签: javascript json xmlhttprequest

在加载网页时,微调器应该在浏览器中停止,但它不会继续旋转,我该如何阻止它。

<!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;

enter image description here

0 个答案:

没有答案