为什么不能加载网页

来源:1-1 使用load()方法异步请求数据

慕前端7352391

2017-09-12 14:49

<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>使用load()方法异步请求数据</title>
        <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
        <link href="style.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
        <div id="divtest">
            <div class="title">
                <span class="fl">我最爱吃的水果</span> 
                <span class="fr">
                    <input id="btnShow" type="button" value="加载" />
                </span>
            </div>
            <div id="ee" style="width:200px;height:200px"></div>
        </div>
        
        <script type="text/javascript">
            $(function () {
                $("#btnShow").bind("click", function () {
                    $("#ee").load("http://www.baidu.com");
                })
            });
        </script>
    </body>
</html>


写回答 关注

2回答

  • Charlene成成
    2017-11-04 22:55:09

    我叫朋友帮你看了,他说是域名不一样,不能跨域请求。你自己看看是不是。

  • 慕前端7352391
    2017-09-12 14:50:45

    为什么加载不了这个百度的网址

jQuery基础(五)一Ajax应用与常用插件

如何用jquery实现ajax应用,加入学习,有效提高前端开发速度

69095 学习 · 400 问题

查看课程

相似问题