Welcome Guest, Not a member yet? Register   Sign In
Cannot load javascript file into my view
#1

(This post was last modified: 05-23-2020, 12:25 PM by jreklund.)

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

(This post was last modified: 05-23-2020, 12:36 PM by dave friend.)

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

(This post was last modified: 05-24-2020, 08:56 AM by InsiteFX.)

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




Theme © iAndrew 2016 - Forum software by © MyBB