Ajax响应数组

I want to insert ajax response array into form select input. for the purpose i want to look into array. here is my function;

function _get_student_failed_classes()
{
$failed_classes=$this->db->select('class_student.class_id,course.course_code,course.course_name,course.course_credit')
        ->join('class','class.class_id=class_student.class_id','LEFT')
        ->join('course','course.course_id=class.class_course','LEFT')
        ->where('class.class_status',$active)
        ->where('class_student.class_marks <=',50)
        ->where('class_student.student_id',$std_code)
        ->order_by('class.class_id')
        ->get('class_student')->result();
echo $failed_classes;
}

and here is my ajax call in form

$.ajax({
        url: '<?php echo base_url()."index.php/student/get_student_failed_classes/s-14-1"; ?>',
        type: 'POST',   data: std_code,
        success: function(response)
        {

          alert(response);

        },
        error: function()
        {
          alert(error);
        }

I get the response is []

the actual array looks like this

Array
(
[0] => stdClass Object
    (
        [class_id] => 3
        [course_code] => cs3
        [course_name] => cs3
        [course_credit] => 3
    )

[1] => stdClass Object
    (
        [class_id] => 4
        [course_code] => cs4
        [course_name] => cs4
        [course_credit] => 4
    )

[2] => stdClass Object
    (
        [class_id] => 5
        [course_code] => cs5
        [course_name] => cs5
        [course_credit] => 3
    )

)

can some one help me out on this

var objectRet= jQuery.parseJSON(response);
for(var i=0;i<objectRet.length;++i) {
   alert(objectRet[i].class_id)
}
success: function(response) {
   var $select = $('<select id="mySelect"/>');

   var $options = response.map(function(a, i) {
       return $('<option />', {
                  value: a.class_id,
                  text: a.course_code + ' - ' + 
                        a.course_name + ' (' + a.course_credit +')'
       });
   });

   $options.appendTo($select.appendTo($('#someForm')));
}