Cannot load javascript file into my view |
I want to: <script type="text/javascript" src="<?php echo base_url()?>js/graph.js"></script>
But I have this problem: "GET http://localhost/www/js/graph.js net::ERR_ABORTED 404 (Not Found)" But I HAVE the file in this route http://localhost/www/js/graph.js. WTF? Why the js script don't include? Can someone help please?
If it where in that location it would load. So you DO have an incorrect url.
First you need to find the real adress; Just ignore CodeIgniter/PHP for the time being and finding the correct url. Without information about your real directory structure, it may be in this location: http://localhost/js/graph.js
Can you explain the directory structure of your site please?
This is why we always use an assets folder where index.php is.
index.php assets -- css -- js -- img -- images -- plugins etc; Then you can use this to display the it. Code: <script src="<?php echo base_url('assets/js/graph.js'); ?></script> What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |