public function question_class() { $start_grade = intval($this->input->post('start_grade')); $end_grade = intval($this->input->post('end_grade')); $grade_id = intval($this->input->post('grade_id')); $list = array(); if ($start_grade && $end_grade) { $list = ClassModel::get_grade_area_class($start_grade, $end_grade); } elseif ($grade_id) { $list = ClassModel::get_class_list($grade_id); sort($list); } echo json_encode($list); }