Hi guys..i am just dealing with codeigniter framework..

Could you guys tell me where exactly should i put the ajax/javascript file in the codeigniter directory?

I mean could it be in the application folder or whatever, or it doesnt matter?
because i want to know which is the best practice to apply.

Thank you :)

Recommended Answers

All 4 Replies

By ajax you mean .js file? It doesn't matter. Put near all your .js files. I have a folder in root directory called js and there I put all js files.

P.S. hehe, 100 posts by me alredy :)

By ajax you mean .js file? It doesn't matter. Put near all your .js files. I have a folder in root directory called js and there I put all js files.

P.S. hehe, 100 posts by me alredy :)

HI, thanks for answering me :)
em but i got one more question, regarding the ajax file, if i use the ajax with jquery then when i need to do for example like this :

type: "POST",
url: "<?php echo base_url();?>external/reply.php"

and my reply.php file is located in the root directory,and its require the database connection, will then i need to use the codeigniter database library whenever i want to interact with the database?because when i use the normal way without the codeigniter functions my codes wont work and i need to configure my database by making config.php file and then link it to my reply.php.

any help? thank you :)

ill then i need to use the codeigniter database library whenever i want to interact with the database?

I don't know. But why don't you put this code in some controller function and then use the CI's database functions?

ouh okay2,i'll try to do it..Thanks so much for helping :)

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.