You will find using jQuery for handling ajax request alot easier, and cross browser support. When returning/processing any ajax request you will want to use json to respond.
//jQuery
$("#some_form").submit(function(){
event.preventDefault();
$.ajax({
url: '<?php echo site_url('controller/method');?>',
dataType: 'json',
type: 'POST',
data: $(this).serialize(),
success: function(data){
if(data.response =='true'){
alert(data.message); //change alert to updated DOM somewhere
}
},
error: function(){
alert('Something major failed');
}
});
});
//In controller/method
$data['response'] = 'false'; //default response
if($this->form_validation->run())
{
$data['some_field'] = $this->input->post('some_field');
$data['response'] = 'true'; // form submission worked
$data['message'] = 'successful ajax request string';
}
echo json_encode($data);