How to Post the whole Table-Data to a PHP-Script

How to Post the whole Table-Data to a PHP-Script

Deluxe23Deluxe23 Posts: 2Questions: 1Answers: 0

i create to select boxes where people can choice something and then press a "add-button"

        var t = $('#sell_list').DataTable();
        t.row.add( [
            $('#sell_companys').val(),
            $('#sell_modells').val(),
            'yo',
            ' <button type="button" OnClick="delete()" class="btn-xs btn-primary"><i class="fa fa-trash"></i></button>'
        ] ).draw( false );

then a new row added to the table and will be show. this works nice.
i want to create a new button "finish" , when the user click the complete data table content will sent via ajax to a php script, how can i do that ?

Answers

  • kthorngrenkthorngren Posts: 20,275Questions: 26Answers: 4,765

    You can use jQuery's ajax to send the data to the server script. The data option of jQuery's ajax is used to send data to the server.

    Kevin

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @Deluxe23 ,

    You'll need to get the row data with rows().data(), and then send that to the server in an Ajax call. That call will be outside of DataTables, so you can just google how to make those Ajax calls.

    Cheers,

    Colin

  • Deluxe23Deluxe23 Posts: 2Questions: 1Answers: 0

    Thank you very much

This discussion has been closed.