Reputation: 12163
Are there any CodeIgniter libraries that help simplify the process of using jQuery JSON with Ci?
Upvotes: 0
Views: 1099
Reputation: 16373
Well, there is an ajax helper:
http://codeigniter.com/wiki/jQuery_Ajax_Helper
But why do you really need it?
What I usually do is just add this to my controllers:
if($this->input->is_ajax_request())
{
echo json_encode($something);
exit;
}
The "$this->input->is_ajax_request()
" is part of the Input library.
That way, you can use the same controllers for both ajax and non ajax requests and just conditionally include logic.
You can do GET and POST requests with jQuery .ajax: http://api.jquery.com/jQuery.ajax/
Upvotes: 2