开发者

how to load a page without refreshing the browser in jsp

开发者 https://www.devze.com 2023-02-10 04:39 出处:网络
index.html <head> <script type=\"text/javascript\"> $(function() { $(\".navigation a\").click(function() {

index.html

 <head>
 <script type="text/javascript">

    $(function() {

        $(".navigation a").click(function() {

            $("#content").load($(this).attr("href"));

            return false;
        });

    });
</script>

&开发者_如何学Clt;/head>
 <body>
<ul class="navigation">
    <li><a href="robo.html">Content 1</a></li>
    <li><a href="content2.html">Content 2</a></li>
    <li><a href="content3.html">Content 3</a></li>
</ul>

<div id="content">
</div>

 conten1.jsp
i have accordian to display

if i run content1.jsp the accordian gets displayed,but by clicking link in index.html file it is not showing acccordian but only the text in accordian


check your stylesheet and js is linked with in head section.. this may be reason but i'm not sure .you can add those stuffs in loading pages


First possible approach (I would not recommend it): use frames or iframes -- the ancient solution for this.

Proper solution: use AJAX, with some library like jQuery that knows to execute <script>s and include css files linked by your response HTML.

0

精彩评论

暂无评论...
验证码 换一张
取 消