title: Ajax response array
body: <p>I want to insert ajax response array into form select input. for the purpose i want to look into array. here is my function;</p>
  
  <pre><code>function _get_student_failed_classes()
  {
  $failed_classes=$this-&gt;db-&gt;select('class_student.class_id,course.course_code,course.course_name,course.course_credit')
          -&gt;join('class','class.class_id=class_student.class_id','LEFT')
          -&gt;join('course','course.course_id=class.class_course','LEFT')
          -&gt;where('class.class_status',$active)
          -&gt;where('class_student.class_marks &lt;=',50)
          -&gt;where('class_student.student_id',$std_code)
          -&gt;order_by('class.class_id')
          -&gt;get('class_student')-&gt;result();
  echo $failed_classes;
  }
  </code></pre>
  
  <p>and here is my ajax call in form </p>
  
  <pre><code>$.ajax({
          url: '&lt;?php echo base_url()."index.php/student/get_student_failed_classes/s-14-1"; ?&gt;',
          type: 'POST',   data: std_code,
          success: function(response)
          {
  
            alert(response);
  
          },
          error: function()
          {
            alert(error);
          }
  </code></pre>
  
  <p>I get the response is []</p>
  
  <p>the actual array looks like this </p>
  
  <pre><code>Array
  (
  [0] =&gt; stdClass Object
      (
          [class_id] =&gt; 3
          [course_code] =&gt; cs3
          [course_name] =&gt; cs3
          [course_credit] =&gt; 3
      )
  
  [1] =&gt; stdClass Object
      (
          [class_id] =&gt; 4
          [course_code] =&gt; cs4
          [course_name] =&gt; cs4
          [course_credit] =&gt; 4
      )
  
  [2] =&gt; stdClass Object
      (
          [class_id] =&gt; 5
          [course_code] =&gt; cs5
          [course_name] =&gt; cs5
          [course_credit] =&gt; 3
      )
  
  )
  </code></pre>
  
  <p>can some one help me out on this</p>