I have a simple javascript file like so:
$(document).ready(function () {
alert("my controller");
});
I have an HTML file like so:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript" src="/js/generateLineupController.js"></script>
</body>
</html>
for the love of all things holy why in the world would the alert not show? I get a 200 on GET for the javascript file, so it's loading.
2 Answers 2
Several problems here.
You're trying to load the script twice for some reason. Don't do that. Load it in
<head>, or at the end of<body>, but not both.You're trying to use jQuery syntax (
$(...)), but you haven't loaded the jQuery library. You'll need that.
1 Comment
The $(document).ready(...) indicates that you are trying to use jQuery, but you aren't loading jQuery in your page. Check your console log; you will see the errors there.
Also, there's no need to load the script twice with two <script> tags; just load it once.
3 Comments
src will cause problems. Also, are you sure you haven't checked don't show any more alerts for this page or anything similar in your browser?
node.jstag on this question? It's distracting me from answering your question because I'm waiting to hear about how node is involved :)