I'm new Jquery and AJAX and I've really been struggling with the syntax I've been trying to use other tutorials as reference but nothing seems to work. I feel I have the right idea but syntax is wrong somewhere please help.
Here is the Ajax side
var var_numdatacheck  = <?php echo $datacheck; ?>;
  var var_numcheck = parseInt(var_numdatacheck);
 function activitycheck(){
 $.ajax({
          type: 'POST',
          url: 'feedupdate.php',
          data: {function: '3test', datacheck: var_numcheck},
         dataType: "json",
          success: function(data) {
              var json = eval('(' + data + ')');
              $('#datacheck').html(json['0']);
         var var_numcheck = parseInt(msg);
     //setTimeout('activitycheck()',1000)},
  error:function(msg) {
     console.log(msg);
  }
        });
    }   
  $(document).ready(function()  {
     activitycheck();
  });
Here is the php the AJAX calls
<?php
require "dbc.php";
$function = $_POST['function'];
$datacheck = $_POST['datacheck'];
$search="SELECT * FROM Feedtest ORDER BY id DESC";
$request = mysql_query($search);
$update= mysql_fetch_array($request);
$updateid = $update['id'];
$updatecheck = mysql_num_rows($request);
$data = array();
if ($function == $datacheck){
echo $updatecheck;
echo $datacheck;
}
if ($function == "3test" && $updatecheck > $datacheck )      {    
 $updatesearch="SELECT * FROM Feedtest WHERE id = '$updateid' ORDER BY id DESC";
$updatequery = mysql_query($updatesearch);
$data['id'] = $updateid;
while ($row = mysql_fetch_array($updatequery))
{
  ?>
 <?php $data[]= $row['First Name']; ?>
<?php
}
echo json_encode($data); 
} 
?>
</div>
</ul>
 
     
    