How do I read from a file in PHP and complete the action in JavaScript/CSS?

Let’s say I have 2 boxes and a text file called data.txt:

<?php 
    $myfile = fopen("data.txt") or die("Unable to open file");
 ?>
<button> Go </button>
<div id = "box1" >
    <h5> BOX 1 </h5>
<?php echo fread($myfile,filesize("data.txt")); ?>
</div>

<div id = "box2>
<h5> BOX 2 </h5>
</div>
#box1 {
      width: 100px;
      height: 200px;
      background-color: red;
      position: absolute;
      left: 0px;
      top: 0px;
      text-align: center;
      font-family: Times New Roman;
    }

#box2 {
      width: 100px;
      height: 200px;
      background-color: white;
      position: absolute;
      left: 0px;
      top: 0px;
      text-align: center;
      font-family: Times New Roman;
    }

How do I move the text from the text file, “Hello World” from box 1 to box 2 using plain JavaScript?