This is my controller's function Code:
public function get_grade_by_marks()
{
$obmarks = $this->input->post('ob_marks');
$result=$this->ajax->get_grade_by_marks($obmarks);
$name = $result->name;
return $name;
}
Changing return with echo solved the issue.
And below is my Model's Function code
public function get_grade_by_marks($obmarks)
{
$this->db->select('name');
$this->db->from('grades');
$this->db->where("$obmarks BETWEEN mark_from AND mark_to");
return $this->db->get()->row();
}
When I debug it, it return "B" or "A"