Codeigniter 3, если Ajax запрос

if (!$this->input->is_ajax_request()) {
   exit('No direct script access allowed');
}
Abdullah al Mamun