What are some alternative methods to dynamically update a div container with data from a PHP file without including the entire file?

When dynamically updating a div container with data from a PHP file, it is common to use AJAX to fetch the data without reloading the entire page. One way to achieve this is by creating a separate PHP file that outputs only the data needed for the div container, and then use AJAX to fetch this data and update the div container accordingly.

<?php
// data.php
// This PHP file contains the data that needs to be dynamically updated in the div container

$data = "This is the updated data from PHP file.";

echo $data;
?>