gpt4 book ai didi

javascript - 我在使用 jquery ajax 加载文本文件内容时遇到一些问题

转载 作者:行者123 更新时间:2023-12-01 01:13:35 25 4
gpt4 key购买 nike

我已经尝试了很多,但没有找到任何帮助。请帮助我..

<!DOCTYPE html>
<html>

<head>
<title></title>
</head>

<body>
<a href="#" id="nav1">Link1</a>|| <a href="#" id="nav2">Link2</a>
<div id="target">&nbsp</div>
<br clear="all" />
<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript">
$(document).ready(function() {
$('#nav1').click(function() {
$('#target').load('home.txt');
});
$('#nav2').click(function() {
$('#target').load('link.txt');
});
)
};
</script>
</body>

</html>

请帮助我。我想在点击link1和link2时获取txt文件

最佳答案

script标签不能有 src 属性和正文,您需要使用单独的脚本标签。

<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script>

<script>
$(document).ready(function () {
$('#nav1').click(function () {
$('#target').load('home.txt');
});
$('#nav2').click(function () {
$('#target').load('link.txt');
});
});
</script>

This attribute specifies the URI of an external script; this can be used as an alternative to embedding a script directly within a document. script elements with an src attribute specified should not have a script embedded within its tags.

关于javascript - 我在使用 jquery ajax 加载文本文件内容时遇到一些问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54958104/

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