title: How get AJAX to Post JSON data into div
body: <p>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.</p>
  
  <p>Here is the Ajax side</p>
  
  <pre><code>var var_numdatacheck  = &lt;?php echo $datacheck; ?&gt;;
    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();
    });
  </code></pre>
  
  <p>Here is the php the AJAX calls</p>
  
  <pre><code>&lt;?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" &amp;&amp; $updatecheck &gt; $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))
  
  {
    ?&gt;
  
   &lt;?php $data[]= $row['First Name']; ?&gt;
  &lt;?php
  }
  echo json_encode($data); 
  } 
  ?&gt;
  &lt;/div&gt;
  &lt;/ul&gt;
  </code></pre>