How can PHP be used to create navigation if JavaScript is disabled, while still maintaining the option for Ajax navigation if JavaScript is enabled?

When JavaScript is disabled, PHP can be used to create navigation by generating static links that point to different pages on the website. This ensures that users without JavaScript can still navigate the website. To maintain the option for Ajax navigation if JavaScript is enabled, you can use JavaScript to intercept the clicks on these static links and make Ajax requests instead.

<?php
// PHP code to generate navigation links
$pages = array("Home", "About", "Services", "Contact");

foreach ($pages as $page) {
    echo "<a href='$page.php'>$page</a>";
}
?>