$('#myform').serialize() send to server

$('#myform').serialize() send to server

Massimo74Massimo74 Posts: 85Questions: 1Answers: 0

hi I would like to pass to the server
var $FormData = $('#myform').serialize();
to get the dataset for the table.

better to use: fnServerData o fnServerParams
Thanks.

Replies

  • rf1234rf1234 Posts: 2,993Questions: 87Answers: 421
    edited January 2020

    In this post you see how to post a variable to the server using Editor with data tables:
    https://datatables.net/forums/discussion/60000/ext-search-push-not-working-with-serverside#first

    Search for "startDateExpired" on that page.

  • Massimo74Massimo74 Posts: 85Questions: 1Answers: 0
    edited January 2020

    sorry for a question, but if I extract the data first can I then convert it to a dataset?

    es:

    $.ajax ({
    url: "php/report_pro.php",
    data: $("#tb_report_pro").serialize(),
    type: "POST",
    success: function(result){
    $dataset = JSON.parse(result);

             var table_report = $('#tb_report_pro').DataTable({
    

    data : $dataset
    })

    nb: in result comes
    [{"dat":"03\/12\/2019","id_art":"1029","id_Lav":"1","id_Cat":"1","id_Col":"8","id_PC":null,"id_Mat":"1","id_Dif":"4","id_Cli":null,"Qta":"32","Cod_Art":"1246036","DArt":"LAVABO COOL CM 50 INDACO","DLav":"Prima Cottura","DCat":"Lavabo","DCol":"Indaco","DPc":null,"DM":"Fire Clays","DDif":"Macchie Ferro","DCli":null}]

  • Massimo74Massimo74 Posts: 85Questions: 1Answers: 0

    ok solved.
    Thanks

This discussion has been closed.