Blanky
Blanky

Reputation: 251

Script file not loading

I am beating my head against the wall on this. I know Javascript/jQuery well and I can not see the reason why this is not working. I've tried both 2.0.3 and 1.10.2 with the same results.

I'm trying to just do a test to make sure the script file is loaded. I've tried a number of different methods, nothing is working. But when I click the url in the source, it goes to the correct file that has the right code.

This is all I'm trying to do.

$(document).ready(function() {
   alert('test');
});

Which works if I include it in the page between <script> tags. But not when referencing it from a .js file.

This is how I'm loading it:

<script type="text/javscript"
        src="http://localhost/kdev/views/dashboard/js/default.js"></script>

Clicking on that url takes me to the correct file with the alert above.

But's not working. What the crap is going on? What did I forget? Do I have a typo?

The entire page:

<!doctype html>
<html>
<head>
   <title>Test</title>
   <link rel="stylesheet" href="http://localhost/kdev/public/css/default.css" />
   <script type="text/javscript" 
           src="http://localhost/kdev/public/js/jquery-2.0.3.min.js"></script>
   <script type="text/javscript"
           src="http://localhost/kdev/views/dashboard/js/default.js"></script>
</head>
<body>   
<div id="header">
    header
    <br />
    <a href="http://localhost/kdev/index">Index</a>
    <a href="http://localhost/kdev/help">help</a>
               <a href="http://localhost/kdev/dashboard/logout">logout</a>
        </div>

 <div id="content">
 Dashboard... logged in only    </div>
 <div id="footer">feet</div>
</body>
</html>

Upvotes: 0

Views: 25716

Answers (2)

Chris Happy
Chris Happy

Reputation: 7305

My lightbox script file wasn't loeading properly:

<script type="text/javascript" src="js/lightbox-plus-jquery.min.js"></script>

I then removed type="text/javascript" and it loaded perfectly.

Upvotes: 0

Dvir
Dvir

Reputation: 3339

Change this (You missed 'a' char in 'javascript')

 <script type="text/javscript"
        src="http://localhost/kdev/views/dashboard/js/default.js"></script>

to this:

<script type="text/javascript"
        src="http://localhost/kdev/views/dashboard/js/default.js"></script>

Upvotes: 6

Related Questions