CodeIgniter Forums
Loading external JS file - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Loading external JS file (/showthread.php?tid=59464)



Loading external JS file - El Forum - 10-08-2013

[eluser]mzvasiq[/eluser]
I'm trying to load an external JS file in my Login view with the following code

Code:
script type="text/javascript" src="<?php echo base_url();?>javascript/adminScripts.js"

The javascript folder is inside the 'application' folder. I don't know what is the problem because i searched on Google and everyone uses this same code to include external files.

The Server says '404 Error'.

I looked it up a lot on this code but still I'm unable to figure out why am i getting a 404 Error.


Loading external JS file - El Forum - 10-08-2013

[eluser]noideawhattotypehere[/eluser]
Application folder is blocked with htaccess (by default), you shouldnt put any assets in there.

Another thing is that, base_url != base_url/application :p


Loading external JS file - El Forum - 10-08-2013

[eluser]mzvasiq[/eluser]
So if i want to put an External Js file then where should i put it?

There's a .htaccess file in the application folder though which says "Deny from all"


Loading external JS file - El Forum - 10-08-2013

[eluser]mzvasiq[/eluser]
I understood the problem now.. Thanks
It's working now Big Grin