Codeigniter Javascript Not Found Error
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 c
Solution 1:
You need to change your .htaccess file so that it no longer rewrites requests made to '/assets'.
In other words, you need your .htaccess file to ignore requests to the 'assets' folder and just let the browser load the url as provided. Try this:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Solution 2:
<scriptsrc="<?phpecho base_url(); ?>assets/bootstrap/js/bootstrap.min.js"></script>
This is the correct path.Try it!
Solution 3:
The problem is the .htaccess provided by codeigniter to remove the index.php. Follow this link: http://www.codeigniter.com/userguide2/general/urls.html
Remove this code in your .htaccess and you can load javascript files :).
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Solution 4:
Assets folder must be outside the application folder. Like below snapshot. Then user the below code in views files to include css, js and fonts files.
Folder structure for css/js/fonts files in codeigniter
<linkhref="<?phpecho base_url('assets/css/bootstrap.min.css'); ?>"type="text/css" /><scripttype="text/javascript"src="<?phpecho base_url("assets/js/jquery-1.11.3.min.js"); ?>"></script><scripttype="text/javascript"src="<?phpecho base_url("assets/js/bootstrap.js"); ?>"></script>
Post a Comment for "Codeigniter Javascript Not Found Error"