Pass html table in POST using jQuery

Pass html table in POST using jQuery

i want to get all data in table and post using ajax
the problem is inside td there is an <input>

before i put a condition result like this :
-->{"table":[{"row0":[]},{"row1":[{"cell0":"01509"},{"cell1":"HVS BOLA DUNIA 70 GSM A4"},{"cell2":""},{"cell3":"RIM"},{"cell4":""},{"cell5":"320,000"},{"cell6":""}]}]}

cell2 and 4 are empty


< table id = "so_data" class = "table table-bordered table-hover" >
< thead >
< tr class = "kop" >
< th class = "text-center" style = " width:50px;" > Code </ th >
< th class = "text-center" > Description </ th >
< th class = "text-center" style = " width:70px;" > Qty </ th >
< th class = "text-center" style = " width:30px;" > Unit </ th >
< th class = "text-center" style = " width:80px;" > Price </ th >
< th class = "text-center" style = " width:110px;" > Total </ th >
< th class = "text-center" style = " width:50px;" > Delete </ th >
</ tr >
</ thead >
< tbody >
<?php foreach ( $soDtl as $row ) { ? >
< tr >
< td > <?php echo $row -> Code ; ? > </ td >
< td > <?php echo $row -> description ; ? > </ td >
< td class = "text-right" >
< input type = "text" value = " <?php echo $row -> QtyTemp ? > "
class = "eData" />
</ td >
< td > <?php echo $row -> UnitName ; ? > </ td >
< td class = "text-right" >
< input type = "text" value = " <?php echo $row -> Price ? > "
class = "eDataPrice" />
</ td >
< td class = "text-right" > <?php echo number_format ( $row -> Total ); ? > </ td >
< td >
< button class = "hapusBaris" ></ button >
</ td >

</ tr >
<?php } ? >
</ tbody >
</ table >


so i put condition
if ( cellIdx == 2 || cellIdx == 4 )
retVal [ 'cell' + cellIdx ] = cell . children (). val ()
else


but error


function Simpan ()
{
var tbl = $ ( '#so_data tr' ). map ( function ( rowIdx , row ) {
var rowObj = $ ( row ). find ( 'td' ). map ( function ( cellIdx , cell ) {
var retVal = {};
if ( cellIdx == 2 || cellIdx == 4 )
retVal [ 'cell' + cellIdx ] = cell . children (). val ()
else
retVal [ 'cell' + cellIdx ] = cell . textContent . trim ();
return retVal ;
}). get ();
var retVal = {};
retVal [ 'row' + rowIdx ] = rowObj ;
return retVal ;
}). get ();
console . log ( '-->' + JSON . stringify ({ table: tbl }));

// $.post('/mypage', {table: tbl}, function(data, textStatus, jqXHR) {
// console.log('success');
// })
}