Your ajax request needs a string echoed as a string.
$data['day'] = $_POST['currentDay'];
$data['month'] = $_POST['currentMonth'];
$data['year'] = $_POST['currentYear'];
$date = $data['year']."-".$data['month']."-".$data['day'];
$this->load->model('search_form');
$output['details'] = $this->search_form->searchDateRetrievedIncoming($date);
echo json_encode($data);
An array cannot be echoed out correctly if it's not in a data format, such as JSON.
Now we, take the data in your javascript
$.ajax({
url: "<?php echo base_url();?>/Index/viewDayDocuments",
type: 'post',
data: {currentDay: 'currentDay', currentMonth: 'currentMonth', currentYear: 'currentYear'},
success: function(result){
$('.list').text('');
$('.list').remove();
date = JSON.parse(result);
$(".listIncoming").html("<p class = 'list'>This is the: "+ date.month +"/"+date.day+ "/"+date.year +"</p>");
$("#myform").show(500);
}
});
In this module, I transformed the STRING from your PHP file into a JSON object so it can be read properly.