1

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-->
2
  • I just realised how vague this is. Basically, the jQuery("#div1").load("download1473.mediafireuserdownload.com/feen32om7deg/…); is the issue, it just won't appear. If i manually run it in the console, it works Commented Oct 3, 2017 at 20:00
  • Yes, I recommend using files locally while coding! Commented Oct 3, 2017 at 20:18

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I tried that beforehand, but I guess I just hadn't realised that my code was originally wrong

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.