Quantcast
Viewing all articles
Browse latest Browse all 82152

Cannot add data to table

i am newbie in web programming and datatables and i am trying to add new data to my tables using fnAddData() but it not work

here is my code

$('#btn_ubahbj').click( function() {

                    //inisialisasi table upproses

                    Otableupproses=$('#tableupproses').dataTable( {
                    'sDom': 't',
                    "bServerSide": false,
                    "sServerMethod": "POST",
                    "fnServerParams": function ( aoData ) {
                            aoData.push( { "name": "idbom", "value": window.id_bom } );
                        },
                    "sAjaxSource": "<?=base_url()?>index.php/master_bj/ambilbomproses",
                    "sAjaxDataProp": "callback",
                    "bDestroy": true,
                    "bAutoWidth": false,
                    "aoColumns":    [
                                        { "sTitle": "ID Proses",   "mDataProp": "id_proses_produksi"},
                                        { "sTitle": "Nama Proses",  "mDataProp": "nama"},
                                        { "sTitle": "Lama Proses", "mDataProp": "waktu"},
                                        { "sTitle": "Jumlah Mesin",  "mDataProp": "jumlah_mesin"},
                                    ]
                    } );
                    
                } );

//trying to add data 
$('#btnuptambahproses').click(

                    Otableupproses.fnAddData( [$('#prosesupbj').val(),$("#prosesupbj option:selected").text(),$('#txtuplamaproses').val(),$('#txtupjmlmesin').val()]
                    );
                 });


and here is my php

function ambilbomproses()
    {
        $idbom= $this->input->post('idbom');
        $res['dataproses']=$this->bom_punya_proses_model->getbomproses($idbom);
$res['dataproses'] is array 2D
        echo json_encode(array("callback" => $res['dataproses']));
    }

load data and all function is working but add data not working
how can i add data to my tables ? i am so frustating please help

sorry for my stupidity :( please help

Viewing all articles
Browse latest Browse all 82152

Trending Articles