I want to do is send the array values from a javascript variable to php using ajax.
My problem is after I click the send button and when i got to php file to see if its passed or not its empty.
But when i click the network headers the ajax send the array already.
Here is the result i see in the network after i click the send button:
Form Data:
term[0][]:awdawd
term[0][]:awdawd
term[0][]:Male
term[0][]:<button class='delete'>Delete</button>
term[1][]:awdaw
term[1][]:wda
term[1][]:Female
term[1][]:<button class='delete'>Delete</button>
term[2][]:awdawd
term[2][]:awdawd
term[2][]:Male
term[2][]:<button class='delete'>Delete</button>
My php file should receive the array but its not can anyone help me.
script:
$("#saveTable").click(function(){
$.ajax(
{
url: "saveTable.php",
type: "POST",
data: { tableArray: dataSet},
success: function (result) {
}
});
});
saveTable.php:
<?php
$tableArray = $_REQUEST['tableArray'];
echo $tableArray;
?>
dataSetin script...echo $tableArray, instead useprint_r($tableArray)as it's an array!!