Ajax form validation in codeigniter
Rather than printing out via "this->form_validation->xxxx_error" you can utilize Form Helper method "form_error()" to call the error messages.
So you can do something like..
$data = array(
'course_code' => form_error('course_code'),
'name' => form_error('name')
);
You might also consider setting the output content type header for JSON data.
$this->output->set_content_type('application/json');
echo json_encode($data);
What version of Codeigniter are you using? Did you remember to load the validation library in your construct?
$this->load->library('form_validation');