<script>
function getstaff(){
var staffinfo = $('#group').val();
var myJSONText = JSON.stringify(staffinfo);
    $.ajax({
    type:"POST",
    data:{data:myJSONText},
    url:"staffDetails.php",
    success: function(result){
    alert(result);
    }
});
}
</script>
How do I retrieve the posted data in staffDetails.php file. It some how gives me drastic errors. Can anyone suggest how exactly to retrieve what I sent to this php file
<?php
$data = JSON.parse($_POST['data'],',');
echo $data;
?>
                Use json_decode to decode a json array in PHP
 $data = json_decode($_POST['data']);
http://php.net/manual/en/function.json-decode.php
http://php.net/manual/en/function.json-decode.php
<?php
$data = json_decode($_POST['data']);
print_r($data);
?>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With