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 Stata链式中介效应代码修改
  • ¥15 latex投稿显示click download
  • ¥15 请问读取环境变量文件失败是什么原因?
  • ¥15 在若依框架下实现人脸识别
  • ¥15 添加组件无法加载页面,某块加载卡住
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用