CodeIgniter Forums
Javascript with Code Igniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- 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:
Code:
<[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

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


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

[eluser]pickupman[/eluser]
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.