What are the potential pitfalls of using include() instead of frames in PHP?

Using include() instead of frames in PHP can lead to potential pitfalls such as decreased performance due to additional server requests and slower loading times. To avoid these issues, it is recommended to use AJAX to dynamically load content without refreshing the entire page.

<?php
// Example of using AJAX to dynamically load content without frames
?>
<!DOCTYPE html>
<html>
<head>
    <title>AJAX Example</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script>
        $(document).ready(function(){
            $("#load_content").click(function(){
                $("#content").load("content.php");
            });
        });
    </script>
</head>
<body>
    <div id="content">
        <!-- Content will be loaded here -->
    </div>
    <button id="load_content">Load Content</button>
</body>
</html>