how to send current datatable in email

how to send current datatable in email

schinamanagondaschinamanagonda Posts: 38Questions: 5Answers: 0

how to send current datatable in email

Answers

  • allanallan Posts: 60,962Questions: 1Answers: 9,940 Site admin

    You'll need to elaborate a little please. Do you mean a link to the page, the content from the table, a screenshot or something else?

    Allan

  • schinamanagondaschinamanagonda Posts: 38Questions: 5Answers: 0
    edited October 2023

    content of datatable in to an email as datatable

  • allanallan Posts: 60,962Questions: 1Answers: 9,940 Site admin

    To send an e-mail you'll need a server-side process that actually does the sending. I would suggest using buttons.exportData() to get the data to send, then use Ajax to your script that will actually send the data and submit the data to it as a parameter.

    Allan

  • schinamanagondaschinamanagonda Posts: 38Questions: 5Answers: 0

    can you give me an example please

  • allanallan Posts: 60,962Questions: 1Answers: 9,940 Site admin
    edited October 2023

    Not of the server-side script. That is outside of the scope of the free support I can give. I don't even know what server-side environment you are working with.

    In terms of the client-side:

    var table = $('#myTable').DataTable({
      buttons: [{
        text: 'Export data',
        action: function (e, dt) {
          var exportData = dt.buttons.exportData();
    
          // Use $.ajax or `fetch` to send `exportData` to the server to e-mail
          // ...
        }
      }]
    });
    

    Allan

Sign In or Register to comment.