gpt4 book ai didi

javascript - JQuery 脚本在 JSFiddle 中有效,但在我自己的浏览器中无效

转载 作者:行者123 更新时间:2023-11-30 12:51:21 25 4
gpt4 key购买 nike

正如标题所说...尝试更改 JQuery 版本。尝试了不同的浏览器(Mozilla、Chrome、Opera、IE)。还尝试从我自己的服务器加载 JQuery 库。没有任何运气。请帮帮我。

在这里,代码在 JSFiddle 中工作... http://jsfiddle.net/GUuNG/

<!DOCTYPE html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">

$(document).ready(function(){
$("button").click(function(){
$.getJSON("https://prod.api.pvp.net/api/lol/euw/v1.1/summoner/by-name/krepo?api_key=b05c2251-f659-4d24-8b5f-6b25a482b42a" , function(result){
$.each(result, function(key, value){
$("div").append("<b>" +key+"--"+value +"</b><br/>");
});
});
});
});
</script>
</head>
<body>
<button>Get Json Data</button>
<div></div>
</body>
</html>

最佳答案

脚本元素不能有 src 和 body

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.getJSON("https://prod.api.pvp.net/api/lol/euw/v1.1/summoner/by-name/krepo?api_key=b05c2251-f659-4d24-8b5f-6b25a482b42a" , function(result){
$.each(result, function(key, value){
$("div").append("<b>" +key+"--"+value +"</b><br/>");
});
});
});
});
</script>

HTML4

The script may be defined within the contents of the SCRIPT element or in an external file. If the src attribute is not set, user agents must interpret the contents of the element as the script. If the src has a URI value, user agents must ignore the element's contents and retrieve the script via the URI. Note that the charset attribute refers to the character encoding of the script designated by the src attribute; it does not concern the content of the SCRIPT element.

关于javascript - JQuery 脚本在 JSFiddle 中有效,但在我自己的浏览器中无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20851005/

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