如何在cibonfire中加载json?

i have this controller from penjualan_resep module

public function load_data_mahasiswa() {
 $term = $_POST['parent_id'];
$response = array();
$mahasiswa = $this->mahasiswa_model->find_by('nim', $term); //load data from mahasiswa model
if ($mahasiswa) {
    $response[] = $mahasiswa;
}else{
    $response['error'] = 'Data Kosong';
}
echo json_encode($response); //convert to json
}

and this is my view

<script language="javascript">
$(document).ready(function() {
    $("#nim").keyup(function() {
        var nisp = $('#nim').val();
        $.post('<?php echo site_url(SITE_AREA.'/content/penjualan_resep/load_data_mahasiswa');?>', //load data using json
                {parent_id: nisp},
        function(data) {
            $('#nama_pasien').val(data[0].nama); //load from database
        }, 'json'
                );
    });
});

<table>
                        <tr>
                            <td>NIM</td>
                            <td colspan="4"><input type="text" name="nim" id="nim"></td>
                        </tr>
                        <tr>
                            <td>Nama</td>
                            <td colspan="4"><input type="text" name="nama" id="nama_pasien"></td>
                        </tr>
</table>

i want to autofill form "Nama", when i fill form "NIM" using json, but it can't? how to solve it? i'm using cibonfire framework(base on codeigniter).

You have to parse json since you are using $.post.

 var data1 = $.parseJSON(data);
 alert(data1[0].nama)
 $('#nama_pasien').val(data1[0].nama); //load from database