External Javascript |
Hi,
I am using CI4 My preferred way of using javascript/jquery is to use external .js files Code: <script src="<?php echo base_url('includes/common/js/myfunctions.js'); ?>" ></script> rather than including the javascript/jquery in the page Code: $.ajax({
Just try to use full url, it's an external js you cant do it. If you put the js script in your view, you can use it. But set it in controller
Thanks for the replies. Was worth asking the question as i'm finding more and more good stuff in Ci4.
You can add it to the html head section like so.
Code: <script type="text/javascript"> Now you can use it anywhere you like in jQuery. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Thanks InsiteFX, This is probably a better solution for me as I can reuse the external script rather than duplicating it on a per page basis.
|
Welcome Guest, Not a member yet? Register Sign In |