Would like to ask for a help. I'm having an issue about getting the right data that I wanted. Maybe there's something lack in my code. I always get null.
I didn't received any error on the console tab.
Here's my ajax
$(document).ready(function() {
  $(".fsubmit").click(function() {    
   var emailval = $("#email").val().trim();
   
   $.ajax({
    url: '/test.php',
    type: 'POST',
    dataType: 'json',
    data: 'email='+emailval,
    success: function(data) { 
     console.log(data);
     return false;
    }
   });
  });
 });Maybe you could help me fix the PHP. Still learning some stuff. Kindly put some details for lesson please.
Here's my PHP code
<?php 
    $date = new DateTime();
    $datelog = $date->format('d.m.Y h:i:s');
    $data = $_POST['data'];
    $message = '[' . $datelog . '] - email: ' . json_encode($data);
    echo($message);
?>
I appreciate your answer!
 
     
     
     
    