52,797
社区成员
发帖
与我相关
我的任务
分享
<?php
页面设置和数据库连接
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title> 页面名称 </title>
</head>
<body>
。。。。。主页面内容。。。。。。
。。。。。主页面内容。。。。。。
<div id="contentBox">
<?php
读取数据库,输出页面初始时的数据
?>
</div>
。。。。。主页面内容。。。。。。
。。。。。主页面内容。。。。。。
</body>
</html>
就再写一个ajax加载的页面
<?php
页面设置和数据库连接
?>
<?php
读取数据库,输出读取的数据
?>
这个页面只有数据输出,没有主页面的其它内容
用ajax加载这个页面之后,用
document.getElementById("contentBox").innerHTML=xmlHttp.responseText;
更新主页面的<div id="contentBox">区域
[/quote]
如果数据库中的数据很多,document.getElementById("contentBox").innerHTML=xmlHttp.responseText;
可以实现吗?
<?php
页面设置和数据库连接
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title> 页面名称 </title>
</head>
<body>
。。。。。主页面内容。。。。。。
。。。。。主页面内容。。。。。。
<div id="contentBox">
<?php
读取数据库,输出页面初始时的数据
?>
</div>
。。。。。主页面内容。。。。。。
。。。。。主页面内容。。。。。。
</body>
</html>
就再写一个ajax加载的页面
<?php
页面设置和数据库连接
?>
<?php
读取数据库,输出读取的数据
?>
这个页面只有数据输出,没有主页面的其它内容
用ajax加载这个页面之后,用
document.getElementById("contentBox").innerHTML=xmlHttp.responseText;
更新主页面的<div id="contentBox">区域