<!DOCTYPE html> <html> <head> <title>ajax局部刷新</title> </head> <body> <header> <nav> <a href="baidu.com" class="current">首页</a> </nav> </header> <section id="content"> <div id="container"> 首页的内容 </div> </section> <script src="jquery_1.9.1/jquery-1.9.1.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $('a').on('click', function(e) { e.preventDefault(); // 阻止链接跳转 $('a.web').removeClass('web'); $(this).addClass('web'); $('#cons').remove(); $('#con').load('/blog/99.php'); // 加载新内容,url地址与该地址下的选择器之间要有空格,表示该url下的#container }); }); </script> </body> </html>
ajax 局部刷新
猜你喜欢
转载自blog.csdn.net/qq_42176520/article/details/80313382
今日推荐
周排行