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 Unity发布gzip压缩的webgl之后让浏览器可以正常显示画面
  • ¥15 有没有人知道这种提示怎么关?现在不做ts项目了不知道咋关了,求解,现在我以前的js项目都是这种提示了
  • ¥15 为什么mysql做了碎片化处理data_free还是很高
  • ¥15 single positional indexer is out-of-bounds
  • ¥15 LSTM 模型数据量需要多少?
  • ¥15 mysql数据抓包开发报表
  • ¥15 linux系统下安装office打不开
  • ¥20 rsync脚本分发错误,文件不齐全
  • ¥15 labview顺序结构与时间延时
  • ¥15 脚本求解,源于数据库脚本变量筛选。