Welcome Guest, Not a member yet? Register   Sign In
CI Beginner AJAX Question.
#1

[eluser]WoolyG[/eluser]
Hi all,

I need to use AJAX for my app, but I'm new to CI and would like some simple help on getting it going. I have searched the forums, but can't find anything of value.

Here's what I've done thus far:
1. Downloaded the AJAX Library (http://codeigniter.com/wiki/AJAX_for_CodeIgniter/)
2. Placed the Ajax.php into application/libraries (is this the right place?)
3. Placed the JS files into their own directory and linked to them from the HTML doc
4. Autoloaded the ajax library:

Autoload.php
Code:
$autoload['libraries'] = array('database', 'ajax');


Now come the questions:
a. How do I make an AJAX call by clicking on (say) a link?
b. I'd like the results to go to a DIV, how do I point to the div I'd like to use?
c. Within the AJAX data, I need to get dynamic data from the DB. How do I do that from within the ajax-called data?

In the case of ( c. ), usually within the file that is called, a new connection to the DB is made so that the AJAX file can make its own DB call. This is all doable using raw PHP, but I'd like to keep to the MVC model, so can anyone tell me how it's done in CI?

If someone could take the time to help me out I would be very grateful.

All the best,
WoolyG


Messages In This Thread
CI Beginner AJAX Question. - by El Forum - 09-02-2010, 01:50 PM
CI Beginner AJAX Question. - by El Forum - 09-04-2010, 12:16 AM
CI Beginner AJAX Question. - by El Forum - 09-05-2010, 05:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB