Ajax技术实现页面无刷新跳转

时间:2023-03-10 06:30:24
Ajax技术实现页面无刷新跳转

Ajax实现无刷新显示新的页面

 <!DOCTYPE html>
<html>
<head>
<script src="/jquery/jquery-1.11.1.min.js">
</script>
<script>
$(document).ready(function(){
$("#btn1").click(function(){
$('#test').load('/example/jquery/demo_test.txt');
})
})
</script>
</head> <body> <h3 id="test">请点击下面的按钮,通过 jQuery AJAX 改变这段文本。</h3>
<button id="btn1" type="button">获得外部的内容</button> </body>
</html>

参考:

jQuery ajax - load() 方法

ajax的异步操作及页面重定向跳转