CodeIgniter Forums
Javascript with Code Igniter - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Javascript with Code Igniter (/showthread.php?tid=31461)

Javascript with Code Igniter - El Forum - 06-20-2010

[eluser]Alfredo Palhares[/eluser]
Hello, I am first time using Code Igniter and I am felling very whit it.

But i having problems no using externals javascript files in my views

When i make:
<[script tag] type="text/javascript" charset="utf-8" src="form_utils.js"></[script tag]>
Note: The file is the same directory as in the view file.
Note 2: I changed the script tag because the forum remove my code if i don't do that.

How do use it?
Is there any documentation that i can read about that?
I searched the hole user manual i didn't found anything.

Thanks already,
Alfredo Palhares

Javascript with Code Igniter - El Forum - 06-20-2010

I think what you're after is
src="&lt;?php echo base_url(); ?&gt;application folder/view folder/file name.js"

Javascript with Code Igniter - El Forum - 06-20-2010

File paths are relative to the index.php file since that's what runs the show. You may find it helpful adding a leading slash to the beginning of your source. After you get your feet wet with CI, you may want to check out Carabiner. A link is provided in my signature, that will minify/combine your css/js files. You can add files dynamically in your controller/views, or do it statically.