public function set_content_type($mime_type, $charset = NULL) { if (strpos($mime_type, '/') === FALSE) { $extension = ltrim($mime_type, '.'); // Is this extension supported? if (isset($this->mimes[$extension])) { $mime_type =& $this->mimes[$extension]; if (is_array($mime_type)) { $mime_type = current($mime_type); } } } $this->mime_type = $mime_type; if (empty($charset)) { $charset = config_item('charset'); } $header = 'Content-Type: ' . $mime_type . (empty($charset) ? '' : '; charset=' . $charset); $this->headers[] = array($header, TRUE); return $this; }
private function processResponseData(array $response) { if (!$this->input->is_ajax_request()) { redirect('/'); } $this->output->set_content_type('application/json'); if ($response['code'] == 200) { if ($response['data']['success']) { $this->output->set_output(json_encode($response['data']['data'])); } } }