weixin_33716557 2017-10-03 19:57 采纳率: 0%
浏览 14

jQuery ajax不会加载代码

I have an html page, for school and I need to make a menu bar. I want to make it local so I have decided to upload menu.html to media fire

menu.html

<html>
<body>
    <nav class="navbar navbar-inverse"
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand">Practice</a>
            </div>
            <ul class="nav navbar-nav">
                <li class="active"></li>
        </div>
    </nav>
</body>

my page wont load this file, there is nothing in the output.

practiceblank.html

<html>
<head>
    <title>Testing Webpage</title>
    <link rel="stylesheet" href="bootstrap.min.css">
    <link rel = "stylesheet" type = "text/css" href = "main.css"/>
    <link rel='icon' href='favicon.ico' type='image/x-icon'/>
    <script>
        var clicks = 0;
        cps = 1;
        function countClicks() {
            clicks += 1;
            document.getElementById("clicks").innerHTML = clicks;
        }
    </script>
</head>
<body class="an1">
    <div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
        jQuery("#div1").load("http://download1473.mediafireuserdownload.com/feen32om7deg/ebw8k296r8caucm/menu.html");
    </script>
<!--The rest is personal-->
  • 写回答

1条回答 默认 最新

  • derek5. 2017-10-03 20:02
    关注

    You should separate the include of the library from the script :

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    
    <script>    
        $(function(){         
            jQuery("#div1").load("http://download1473.mediafireuserdownload.com/feen32om7deg/ebw8k296r8caucm/menu.html");
        });
    </script>
    

    Hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程