First of all, I am sorry for my bad english, I am spanish and I am sorry if I have made something wrong, this is my first post.
I have a problem with loading a javascript file in codeigniter 2.1.4. I didn´t get loaded it in the header of my page. The css files were well loaded. This example attempts to load jquery and bootstrap.
I am following the steps in the documentation of codeigniter and when I create the codeigniter static page "home.php" I want to use bootstrap for design.
The tutorial I followed is this: http://ellislab.com/codeigniter/user-guide/tutorial/static_pages.html
My folder structure :
- htdocs
- myproject (curriculos)
- application
- controller
- pages.php
- views
- templates
- header.php
- pages
- home.php
- about.php
- system
- assets
- bootstrap
- css
- bootstrap.min.css
- js
- bootstrap.min.js
- jquery- 2.1.0.min.js
I have been searching in this forum and others and always I find the same example with base_url() or site_url(). These are mine:
Updated code:
<script type="text/javascript" src="<?php echo base_url(); ?>assets/bootstrap/js/bootstrap.min.js"></script>
My autoload.php with url helper loaded:
$ autoload['helper'] = array('url');
When I try to load the page I get these errors:
GET http://localhost/curriculos/assets/jquery-2.1.0.min.js 404 (Not Found)
GET http://localhost/curriculos/assets/bootstrap/js/bootstrap.min.js 404 (Not Found)
GET http://localhost/curriculos/assets/bootstrap/js/bootstrap.min.js 404 (Not Found)
The strangest is that when you click on one of them it shows you that the file type is trying to be loaded as a text/html and not as an application/javascript as usual:
Can you help me?
Thank you very much for your reply.
RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L]
Someone knows how to change the .htaccess to admit .js files? @Guns @Jai @shan22 – mrroot5