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 C++ 如何判断设置快捷键来实现隐藏/显示窗口
  • ¥15 关于#材料工程#的问题:有没有具有电子阻挡层和空穴阻挡层的电池仿真silvaco代码例子或者其他器件具有阻挡层例子的silvaco代码(最好还有相关文献)
  • ¥60 基于MATLAB的TAOD算法
  • ¥15 Groimp使用疑问
  • ¥15 MDK–ARM里一直找不到调试器
  • ¥15 oracle中sql查询问题
  • ¥15 vue使用gojs3.0版本,在nodeDataArray中的iconSrc使用gif本地路径,展示出来后动画是静态的,不是动态的
  • ¥100 代写个MATLAB代码,有偿
  • ¥15 ansys electronics 2021 R1安装报错,错误代码2,如图
  • ¥15 Dev-c++打字不出现中文,但出现日文