jQuery" load"方法不起作用

时间:2017-02-06 16:52:49

标签: jquery

点击ID为" about"的链接,我试图在div中显示一个单独的页面。为此,我的html结构如下:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Budget Rental</title>
    <link rel="stylesheet" type="text/css" href="style.css"/>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>

</head>

<body>

    <section id="home">



        <div class="container">
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5 col-xl-5 leftcontent">

                    <h1>The Latest</h1>
                    <img class="img-responsive box-shadow" src="images/latestcamera.jpg" alt="Camera"/> <br>

                    <div class="col-xs-4">
                        <img class="img-responsive" src="images/image1.jpg" alt="Camera"/>
                    </div>
                    <div class="col-xs-4">
                        <img class="img-responsive" src="images/image2.jpg" alt="Camera"/>
                    </div>
                    <div class="col-xs-4">
                        <img class="img-responsive" src="images/image3.png" alt="Camera"/>
                    </div>

                    <div class="about-placeholder">
                        <a id="about" href="about.html">Read more about our latest product</a>
                    </div>  

                </div>

            </div>          
        </div>


    </section>

<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>

</body>

</html>

我的剧本如下:

jQuery(document).ready(function(){
    jQuery("#about").click(function(){
        jQuery(".about-placeholder").load("about.html .body-text");
        return false;

    });
});

问题:使用return false时,不是加载。当我删除return false时,它会重定向到另一个页面。我想在此页面中显示它。我该怎么办?

0 个答案:

没有答案