php - codeigniter javascript not found error -


first of all, sorry bad english, spanish , sorry if have made wrong, first post.

i have problem loading javascript file in codeigniter 2.1.4. didn´t loaded in header of page. css files loaded. example attempts load jquery , bootstrap.

i following steps in documentation of codeigniter , when create codeigniter static page "home.php" want use bootstrap design.

the tutorial followed 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 forum , others , find same example base_url() or site_url(). these mine:

updated code:

<script type="text/javascript" src="<?php echo base_url(); ?>assets/bootstrap/js/bootstrap.min.js"></script> 

my autoload.php url helper loaded:

$ autoload['helper'] = array('url'); 

when try load page these errors:

get http://localhost/curriculos/assets/jquery-2.1.0.min.js 404 (not found) http://localhost/curriculos/assets/bootstrap/js/bootstrap.min.js 404 (not found) http://localhost/curriculos/assets/bootstrap/js/bootstrap.min.js 404 (not found)  

the strangest when click on 1 of them shows file type trying loaded text/html , not application/javascript usual:

error loading: file type text/html

can me?

thank reply.

you need change .htaccess file no longer rewrites requests made '/assets'.

in other words, need .htaccess file ignore requests 'assets' folder , let browser load url provided. try this:

rewriteengine on rewritecond $1 !^(index\.php|images|assets|robots\.txt) rewriterule ^(.*)$ index.php/$1 [l] 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -