• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot load javascript file into my view

#1
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?
Reply

#2
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
Reply

#3
Can you explain the directory structure of your site please?
Reply

#4
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 )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.