現在、これを使用して div で新しいコンテンツを開きます (ページ全体を更新する必要はありません)。
file1.php
<?php
//db connection
if ($res = $mysqli->query("SELECT field FROM table")) {
/* determine number of rows result set */
$row = $res->num_rows;
echo "$row";
$res->close();
}
?>
jquery.js
$.ajax({
url: "file1.php",
//this will run as soon as the php script echos the answer
success: function(result){
$('#div1').html(result);
}
});
page1.php
<div id="div1">
</div>
コードが更新されました