I found it !
Code:
// table Html Code
<table id="mytable">
<tr>
<td>papa</td>
<td>popo</td>
<td>pupu</td>
</tr>
<tr>
<td>tata</td>
<td>toto</td>
<td>tutu</td>
</tr>
</table>
Code:
// construct array multi dimensional / JS FILE
for(i=0; i<=length; i++){
// Construct my first dimensional Array
table_export[i]= new Array;
for(j=0;j<width;j++){
// I get value of Cell, one and one in my html Table
result = document.getElementById("table").rows[i].cells[j].innerHTML;
// Insert 'result' in second dimensional Array
table_export[i][j] = result;
}
}
req = { 'tab[]' : table_export};
$.ajax({
type: "POST",
url: "myphpfile.php",
data: req ,
success: function(x){
$('#result').html(x);
}
});
//PHP file
Code:
<?php
print_r($_POST);
?>
//RESULT :
Code:
Array
(
[tab] => Array
(
[0] => papa,popo,pupu
[1] => tata,toto,tutu
)
)
Bookmarks