Guys please give a simple code (specific syntax) on how can I integrate a jquery in my PHP site using codeigniter.
and what configuration should be made in my other php files to make it work.

I also cannot display any image in my php files inside the views folder, i currently use codeigniter 2.1.0

Hello have you ingrated asset helper for codeigniter?

you can see how to integrated Click Here

because i can't decide which one to use, I saw a jquery.php file inside the library folder but i dont know how to call it properly, I now use the normal jquery.js file from the jquery site,, but still I want to learn how to use the reserve jquery library inside the codeigniter, i use codeigniter_2.1.0

what i have done is to include jquery file in the footer just like you include any javascript file. i then use jquery as it is normally used in teh <script>....</script> tag

i tried it and it worked but my another problem is what location should i put my jquery.js file because when i put it inside the C:\xampp\htdocs\CodeIgniter\system\libraries\javascript\jquery.js and i use this code to access this file:

<script type="text/javascript" src="<?php echo base_url().'../system/libraries/javascript/jquery.js' ?>"></script>

my base_url() value inside my config file is this

$config['base_url'] = 'http://localhost/codeigniter/index.php/';

but still i can't access the file, that is why I chose to use the url that directs to the jquery site, but ofcourse when that site had a server shutdown I will not be able to use that url as a reference for my site.

in a project that i worked on i the following file structure:

C:\xampp\htdocs\codeigniter

where codeigniter is the folder where my codeigniter project is.

i have my jquery folder in the codeigniter folder as such

C:\xampp\htdocs\codeigniter\jquery

where my jqeury file resides

the code that i use is as follows:

<script src="<?php echo base_url();?>jquery/jquery.js"></script>

where my base is

$config['base_url'] = 'http://localhost/codeigniter/';

till i can't access the file, that is why I chose to use the url that directs to the jquery site, but ofcourse when that site had a server shutdown I will not be able to use that url as a ref

also if your project is hosted on some server such as www.example.com

then your base url will be

$config['base_url'] = 'http://www.example.com/codeigniter/';

$config['base_url'] = 'http://www.example.com/codeigniter/';

i cannot use that kind of code for my config because whenever i remove the index.php after the "codeigniter/" i cannot target any of my functions inside my controller files, that is why i use " ../ " to make my url back 1 directory so that the base_url will be like this

$config['base_url'] = 'http://localhost/codeigniter/';

but it seems not to work in my case,,

I hope I explained myself clear.

first I made a folder assets inside the root directory

<script type="text/javascript" src="<? echo base_url();?>../assets/javascript/jquery.js"></script>

then I used that code above and it worked, thank you guys for the advice,, you gave me too much hint just to make it work and finally I made it :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.