【发布时间】:2011-07-23 14:26:32
【问题描述】:
如何使用jquery刷新同一php页面生成的div内容
我有一个 test.php,其中包含一个名为 refreshdiv 的 div、一个名为 refreshbutton 的按钮以及显示其他内容的其他 div
refreshdivdiv的内容是php生成的
是否可以在同一页面上单击refreshbutton 时重新加载refreshdiv 的内容,即test.php
这是我的工作
<div id="refreshdiv">
<table>
<?php
$rec=mysql_query("select * from user_master");
for($i=0;$i<mysql_fetch_array($rec);$i++)
{
?>
<tr>
<td>
<?php echo mysql_result($rec,$i,'username');?>
</td>
</tr>
<?php } ?>
</table>
</div>
尝试使用 $.get,但没有得到任何结果
【问题讨论】:
-
你的 jquery 代码是什么样的?
-
您是否看到任何通过 fiddler、firebug 等从服务器返回的内容?
-
不知道这里需要使用哪个jquery函数。因为这涉及同一页面的部分。
-
基本上是 php 和 jquery 的新手...
-
明白。但是您调用
$.get()的地方的javascript/jquery 代码是什么样的?这大概就是问题的根源。您没有理由不能调用$.get()来刷新同一页面的部分内容——这对于jquery 之类的框架非常有用。谢谢!