3
Contributors
5
Replies
7
Views
4 Years
Discussion Span
Last Post by Ryanb
0

No, I'm just using my local server right now. I have no clue how or why, but after all this time I just got it to work..

I did a simple online tutorial from here: http://www.mkyong.com/javascript/how-to-link-an-external-javascript-file/ which had me create an external js file with an alert function. I put the external link in the body, like instructed, and the alert worked so I pasted the other js that wouldn't work before into the new external js file with the alert function and all of a sudden that started working as well. After that I transfered the link from the body to the head to test it and it's still working fine now. I just have no idea why..

I just wish I knew why it works now so I could help some other people that are having a hard time like I was.. Hopefully the links will consistantly start working now also..

Any ideas of how I just got it to work?

0

Most likely you had a syntax error somewhere. Leaving out one character in an important part of your JavaScript code can render the code useless.

0

If you want jquery to work with code in the ext file, put it before the ext file:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="javascript_test.js"></script> , I have the

I've gone from placing these in the head, to placing them at the bottom of the page, just before

</body>

That way I don't have to worry about the document ready stuff.

0

Thanks for the replies guys. Yea it probably was just a small syntax error somewhere I didn't notice. That's a good idea to put it at the end of the body section so everything loads first, I'll start trying that out if it ever doesn't work in the head.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.