Reputation: 95
I am using CodeIgniter. I am trying to load an external javascript file.The .js
file is placed in the views folder itself.
I use the following code for loading the js file in the view file
<script src="/countdown.js" type="text/javascript"></script>
But it does not load the js file. The same code works if i simply put it in the view file. Can someone point out what i am missing here.
Upvotes: 2
Views: 2859
Reputation: 3821
One possible solution is what I had to do when I had to include
things such as CSS and Javascript.
What I did, was put the css and js files into the root of the codeigniter directory (the directory that the application
folder is in, and called them like this:
<script src="<?php echo base_url("countdown.js"); ?>" type="text/javascript"></script>
This will make the call from the directory that application/
is contained in.
Good luck!
Upvotes: 3