jquery.load()を使用した後、index.phpのインクルードを読み取らず、home.phpを読み取れなくなります。これが私のサンプルコードです。しかし、home.phpにsqlcon.phpのコンテンツを手動で追加した場合、それは機能しますが、どうすればこれを修正できますか?
index.php
require 'sqlcon.php';
include 'portal.php';
portal.php
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/ajax.js" type="text/javascript"></script>
<div id="nav">
<ul>
<li><a href="modules/menu/home.php" class="nav">Home</a></li>
<li><a href="modules/menu/setup.php" class="nav"> Setup</a></li>
</ul>
</div>
<div id="subnav"></div>
home.php
$result = mysql_query("SELECT announcement_date,announcement_title,announcement_text FROM sp_announcement") or die(mysql_error());
echo "<table id=\"newspaper-b\">";
echo "<thead>";
echo "<tr>";
echo "<th scope=\"col\">Date</th>";
echo "<th scope=\"col\">Title</th>";
echo "<th scope=\"col\">Announcement</th>";
echo "</tr>";
echo "</thead>";
while($row = mysql_fetch_array( $result )) {
echo "<tr>";
echo '<td>' . $row['announcement_date'] . '</td>';
echo '<td>' . $row['announcement_title'] . '</td>';
echo '<td>' . $row['announcement_text'] . '</td>';
echo "</tr>";
}
echo "</table>";
echo "<br>";
echo "<br>";
ajax.js
$(document).ready(function() {
$('a.nav').click(function() {
var url = $(this).attr('href');
$('#subnav').load(url);
return false;
});
});