Create separate js file and call in separate html
Create separate js file and call in separate html

This is my test case:
http://live.datatables.net/podexico/9/
Currently, the javascript code I've written sits inside the html file. I tried to take the javascript code and put it into a file called myscript.js and i referenced it in the html code as follows:
<script type="text/javascript" src="/js/myscript.js"></script>
I know it can find the js file but I think I need to include some imports into my javascript. Any help with this would be greatly appreciated!
Raj
This discussion has been closed.
Answers
Basically, all of my table functionality that I have coded is gone and only seems to work when the javascript is present in the html file with the table declaration and data
The order of the files are important, so you would need to put that file after the dependent files in the list - but other than that, it should be fine. If that doesn't hep, can you link to a page showing the problem, please.
Colin
Thanks for your response! I think I'm stuck with how I put in the dependent files in the external javascript file.
http://live.datatables.net/podexico/9/
If you go to my javascript here and if I were to make that a completely separate file, are there similar things to import declarations I need in the external js file?
You just add a script include statement like you have for the other .js files:
You are already loading the dependent files in the
head
of your page.Kevin