I have managed to get the correct response to my php page which is listing an array.
I believe that I am passing in AJAX a array string which I can print using $_POST. The problem I am having NOW is when I try to loop through the array to identify its contents which I need to make insertions into a database.
[php]<?php
if (ISSET($_POST['data']))
{ echo "TRUE./n";
}ELSE{
echo "False./n";
}
// look at array var_dump($_POST['data']);
// identifies an array property or key / name pair
var_dump($_POST['data'][1]["ask"]);
// foreach loop: to try to identify array elements
foreach($data as $user)
{ echo $user['ask']; }
?>[/php]
I receive a notice undefined variable data. What am I doing incorrectly?.
sending script
[event]
for (i = 1; i<3; i++)
{
// I collect values for check_a and check_b via radio button responses above
array.push({id:i, ask:check_a, description:check_b});
}
$.ajax
({
type: ‘POST’,
url: ‘out.php’,
data: {data: array},
success: function(msg)
{
alert(msg);
}
});