💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
【jQuery局部刷新】 ~~~ <!DOCTYPE html> <html> <head> <title>ajax局部刷新</title> </head> <body> <header> <nav> <a href="./page1.html" class="current">首页</a> <a href="./page2.html">新闻资讯</a> <a href="./page3.html">用户中心</a> </nav> </header> <section id="content"> <div id="container"> 首页的内容 </div> </section> <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script> <script> $('nav a').on('click', function(e) { e.preventDefault(); // 阻止链接跳转 var url = this.href; // 保存点击的地址 $('nav a.current').removeClass('current'); $(this).addClass('current'); $('#container').remove(); $('#content').load(url + ' #container').fadeIn('slow'); // 加载新内容,url地址与该地址下的选择器之间要有空格,表示该url下的#container }); </script> </body> </html> ~~~ 参考: https://www.cnblogs.com/zlts/p/6960074.html