Extract json data from ajax response
<p>Here is my js function </p>

<pre><code>&lt;script&gt;        
function get_class_group(class_id) {

        $.ajax({
            url: '&lt;?php echo base_url();?&gt;index.php?admin/get_class_group/' + class_id ,
            success: function(response)
            {
                var obj = response;
                alert(obj);
            }
        });

    }

&lt;/script&gt;
</code></pre>

<p>This gives me output like</p>

<pre><code>[{"section_id":"13","name":"A","nick_name":"A","class_id":"13","group_id":"4","teacher_id":"6","id":"4","group_name":"Science"}]
[{"section_id":"13","name":"A","nick_name":"A","class_id":"13","group_id":"4","teacher_id":"6","id":"4","group_name":"Science"},
{"section_id":"22","name":"B","nick_name":"b","class_id":"13","group_id":"4","teacher_id":"0","id":"4","group_name":"Science"}]
</code></pre>

<p>If i write <code>alert(obj.section_id);</code> it gives me </p>

<blockquote>
  <p>error:"undefined".</p>
</blockquote>

<p>How can i get a specific value from this json?</p>

<p>Here is my backend function:</p>

<pre><code>function get_class_group($class_id) 
    {
        $this-&gt;db-&gt;select('section.*, class_group.*');
        $this-&gt;db-&gt;from('section');
        $this-&gt;db-&gt;join('class_group', 'section.group_id = class_group.id', 'left');
        $this-&gt;db-&gt;where('section.class_id', $class_id);
        $groups = $this-&gt;db-&gt;get()-&gt;result_array();

        foreach ($groups as $row) {
            $value[] = $row;
            echo json_encode($value);
        }

    }
</code></pre>