gpt4 book ai didi

javascript - Git 远程仓库没有显示在

转载 作者:行者123 更新时间:2023-11-27 23:36:26 25 4
gpt4 key购买 nike

我试图通过他们的 api 列出我的 github 存储库,但它没有显示在我的页面上,而是使用与 JSFiddle 上工作的完全相同的代码。

调试显示脚本正在被调用,但它只是没有加载到其 <div> 中:

<div id="repos">
<ul id="repo_list">
</ul>
</div>`

这是我的源代码中的标记:

<section id="git-hub">
<div class="container">
<div class="box">
<div class="center">
<h2>GitHub</h2>
<p class="lead">Go on! Take a look through my repos!</p>
<div id="repos">
<ul id="repo_list">
</ul>
</div>
<div id="repo_content"></div>
<script>
$.ajax({
type: "GET",
url: "https://api.github.com/users/google/repos",
dataType: "json",
success: function(result) {
for( i in result ) {
$("#repo_list").append(
"<li><a href='" + result[i].html_url + "' target='_blank'>" +
result[i].name + "</a></li>"
);
console.log("i: " + i);
}
console.log(result);
$("#repo_count").append("Total Repos: " + result.length);
}
});
</script>
</div><!--/.center-->
</div>
</div>
</section><!--/#pricing-->

有人知道这可能是什么原因吗?

最佳答案

您将此 script 标记放在加载 jQuery 的位置之上。将此 script 标记放在您要加载 jQuery 的位置下方。

关于javascript - Git 远程仓库没有显示在 <ul> 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34100415/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com