I want to fetch data based on ajax call
this is my code to get the id
<h3> <a class='click' data-id='<?=$rows["id"];?>'><?=$rows['title'];?></a</h3>
This is my jquery code
 $(document).ready(function() {
    $(".click").on('click',function() {                
      var id= $(this).attr("data-id"); 
      alert(id);
      $.ajax({     
        type: "POST",
        url: "getevents.php", 
        data: {id:id}, 
        dataType: "html",                  
        success: function(response){                    
            console.log(response); 
        }
     });
 })})  
</script>
getevents.php
 <? 
    if(isset($_POST['id'])){
        echo  $_POST['id'] ; 
    }
    $singleevent = mysqli_query($link, 'SELECT * FROM `events` WHERE `id`=."'$id'"  ') or die('error');
    while($row=  mysqli_fetch_array($link , $singleevent)){
            print_r($row); 
    }
  ?> 
$_POST['id']; gets printed in console but not the response . i tried echo and print_r() both in while loop but nothing is in response .
Please help me with this
 
     
    