0

Are there any CodeIgniter libraries that help simplify the process of using jQuery JSON with Ci?

1 Answer 1

2

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/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.