Send datatable data via ajax post to be inserted in database
Send datatable data via ajax post to be inserted in database

Hi! Is there an easy way to send the data via ajax post to be inserted in database?
$("#btnFinalizarRececao").click(function(event)
{
let dados = dtLinhaEncomenda.rows().data();
let ajax = $.ajax({
url: 'finalizarRececao',
type: 'POST',
dataType: 'json',
data:
{
lines: dados,
},
})
.done(function( data )
{
console.log("success");
});
});
I just want the values of the rows and columns.
With this code I got an error Uncaught TypeError: 'insertCell' called on an object that does not implement interface HTMLTableRowElement.
jQuery 14
Many thanks!
Jorge
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You might need to chain the
toArray()
API to result in a Javascript Array instead of an API instance. For example:Kevin