jquery $ .get()为什么没有给我答复? [重复]

问题描述 投票:-2回答:1

正是标题所说的。

我的代码:

<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script>
        var datas;
        $.get("http://gdbrowser.com/api/profile/RobTop", function(data) {
            datas = data;
            document.getElementById("hhh").innerHTML = datas;
        });
    </script>
</head>

<body>
    <h1 id="hhh"></h1>
</body>

我尝试使用getJSON和ajax,均无效

我尝试使用外部脚本

我尝试使用alert()的方法

javascript jquery
1个回答
-2
投票

将脚本移动到</body>元素之前:

...
<script>
   $.get("http://gdbrowser.com/api/profile/RobTop", function(data) {
      // output?
      console.log('data: ', data);
      document.getElementById("hhh").innerHTML = data;
   });
</script>
</body>
© www.soinside.com 2019 - 2024. All rights reserved.