reload after submit

reload after submit

mohammad6006mohammad6006 Posts: 2Questions: 0Answers: 0
edited January 2015 in Free community support

first load of table is without problem with this code :

$('#dataTables-example').dataTable( {
        "processing": true,
        "serverSide": true,
        "ajax": "server_processing.php",
        "aoColumnDefs": [
   {
        "aTargets": [5],
        "mData": null,
        "mRender": function (data, type, full) {
            return '<a href="#" onclick="alert(\''+ full[0] +'\');">Process</a>';
        }
    }
 ]
    } ).fnSort( [ [0,'des'] ] );

but i have a form and i use this function for callback and reload table with new data:

function relodtable() {
        
        var zahar = $('#dataTables-example').dataTable();
        zahar.fnDestroy();
        zahar.fnDraw();
        console.log("Done");
    };

but not show new submited data
and fnDraw(); not reload table data
what api should i use for server side script reload data?

edit: when i click 2 time on submit work perfect

$("form#useradding").submit(function (auf) {
        auf.preventDefault();
        $.post($("form#useradding").attr("action"), $("form#useradding").serialize(), relodtable()
                );
    });
This discussion has been closed.