是否有类似于php include语句的xmLHttpRequest

I want to load this web page: https://castledefense.fun/assets/stat_bar.php into this web page: https://castledefense.fun/dungeons.php so that it displays the users stats from the database in real time as updates occur on the database. On the dungeons.php page you'll notice the stat bar table cells aren't pulling in the users stats from the database so it appears that the php isn't running the mysqli_query statement wrote on the stat_bar.php page.

When I use include 'stat_bar.php' on the dungeons.php page the stat_bar.php page will pull into the dungeons.php page and load all of the users data fine. But when I use the XMLHttpRequest method(what is there now) it just pulls in the table and text and doesn't load anything from the database.

So what it's doing now:

Screenshot of stat_bar.php XHR requested into dungeons.php page - not working: enter image description here

Screenshot of stat_bar.php placed into the dungeon.php via php include' '; - working:

2: enter image description here

What am I doing wrong?

Code for dungeons.php page

<script>
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
  if (xhr.readyState === 4) {
    document.getElementById('ajax').innerHTML = xhr.responseText;
  }
};
xhr.open('GET', 'assets/stat_bar.php');
xhr.send();


</script>

<div id="ajax">

</div>

Code for stat_bar.php page that isn't being ran by php:

<?php


$statQuery = "SELECT * FROM stats WHERE email='$_SESSION[email]'";

$statResult = mysqli_query($conn, $statQuery);

$statRow = mysqli_fetch_row($statResult);

//Equipped Item Query

$qry2 = "SELECT * FROM bag WHERE email = '{$_SESSION['email']}' AND equipped = '1' ";

$result2 = mysqli_query($conn, $qry2);

$statRow2 = mysqli_fetch_row($result2);

?>

<div style="width: 100%;">
<table align="center" width="25%" style="margin-top:10px;margin- 
bottom:10px;border: 1px solid black;">
  <tr>
<th>Level</th>
<th>Experience</th>
<th>Health</th>
<th>Attack</th>
<th>Defense</th>
<th>Gold</th>
 </tr>
 <tr style="text-align: center;">
 <td><?php echo ($statRow[0]); ?></td>
 <td><?php echo ($statRow[1]); ?></td>
 <td><?php echo ($statRow[4]) . "<text style='color:dodgerblue;font-weight:bold;'>+" . $statRow2['9'] . "</font>"; ?></td>
 <td><?php echo ($statRow[5]) . "<text style='color:dodgerblue;font-weight:bold;'>+" . $statRow2['3'] . "</font>"; ?></td>
 <td><?php echo ($statRow[6]) . "<text style='color:dodgerblue;font-weight:bold;'>+" . $statRow2['4'] . "</font>"; ?></td>
 <td><?php echo ($statRow[2]); ?></td>
</tr>
</table>
</div>

p.s. this site is just a coding project to help me learn these languages in a real environment.