I want to delete file contents on the click of a button. I make an ajax request which sends 2 variables, the filename and the name of person who deleted the contents. The PHP function works completely fine, with no errors, but it cannot read the ajax request.
My HTML:
<button onclick="del()">Delete Chat</button>
My JavaScript:
<script>
 function del(){
   var del = new XMLHttpRequest();
   var url = "dc.php?f=" + "<?php echo $mf[0]."-".$mf[1].".txt" ?>"+"&n="+ "<?php echo $me ?>";
   del.send();
 }
</script>
My dc.php file:
<?php 
  $f = $_REQUEST['f'];
  $n = $_REQUEST['n'];
  $del=fopen($f,'w');
    fwrite($del, "Chat Deleted by ".$n."\n<br>");
  fclose($del);
?>
 
     
    