Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I include jQuery file in CodeIgniter?

I would like to use jQuery inside my CodeIngiter Project. I dont know how to include the js file.

I would like to have something like below in my view

<script src='<?php echo base_url().APPPATH ?>js/jquery.js'></script>
<script src='<?php echo base_url().APPPATH ?>js/my-js.js'></script>
like image 650
maan81 Avatar asked Dec 09 '22 03:12

maan81


1 Answers

Firstly, create a folder to put it in. Then you could use a template system like this one.

This lets you add js files either globally in the main template, or by a controller/function basis using the syntax $this->template->add_js('assets/js/jquery.js');

like image 153
Rooneyl Avatar answered Jan 03 '23 07:01

Rooneyl