0

I have two Array objects, one an HTML element: tr, one a DataTables object: row. The row is defined here: https://datatables.net/reference/api/row()

Here is how I am passing these objects in jQuery:

$.post('storeTable.php',
{
    'tr': tr,
    'row': row
},
function(status) {
    console.log("Status: " + status);
});

And this is how my PHP catches them:

<?php
    $tr = $_POST['tr'];
    $row = $_POST['row'];
?>

According to jQuery documentation, I should be able to pass abstract objects like these arrays in this manner, but I get these errors:

enter image description here

The error on line 414 the log is referring to is the line

$.post('storeTable.php',

Is there specific syntax or constraint on functionality I'm not aware of in this case? I have passed data in this way many times before, but never using full arrays.

Jodo1992
  • 745
  • 2
  • 10
  • 32

1 Answers1

0

I am not sure what include in tr and row they have to include json object. If you use row() method as directly it gives to you Datatables row object and you can't send it. You can use for accessing whole row data as json try below code

row = dataTables.row(rowId).data(); 
Ferhat BAŞ
  • 797
  • 7
  • 12