function redirect($to = '', $parent_refresh = array()) { $parent = 0; if ($this->input->is_ajax_request()) { // if( $this->input->post() ) // { // clear flash $this->session->set_flashdata('message', NULL); $this->session->set_flashdata('error', NULL); // } if (!is_array($to) && $to == '-referrer-') { } else { // already starts with http:// ? if (!HC_Lib::is_full_url($to)) { $to = HC_Lib::link($to); $to = $to->url(); } } $out = array('redirect' => $to, 'parent' => $parent, 'parent_refresh' => $parent_refresh); $this->output->set_content_type('application/json'); $this->output->enable_profiler(FALSE); echo json_encode($out); hc_ci_before_exit(); exit; // return; } else { if (!is_array($to) && $to == '-referrer-') { $to = (!isset($_SERVER['HTTP_REFERER']) or $_SERVER['HTTP_REFERER'] == '') ? '' : trim($_SERVER['HTTP_REFERER']); } HC_Lib::redirect($to); return; } return; }