如何通过jQuery刷新一个div? [英] How to Refresh a Div by Jquery?
问题描述
我需要通过jQuery刷新页面中的一个div
I need to Refresh a Div in Page by Jquery
<? if($POST['id']) :?>
<script>
Refresh script
</scriptt>
<?php ednif;?>
<div class="Refresh-Div">
<span> Some Dynamic Content </span>
</div>
推荐答案
我仍然不确定您要寻找的是什么,但是根据您对问题的评论,您需要这样的东西:
I'm still not entirely sure what you are looking for, but based on your comments on the question, you want something like this:
$(".Refresh-Div").load("someScript.php");
这是jQuery load
函数的最简单形式,该函数仅将someScript.php
返回的内容加载到class="Refresh-Div"
元素中,以替换之前的内容.
That is the simplest form the the jQuery load
function, which simply loads whatever is returned by someScript.php
into the element with class="Refresh-Div"
, replacing whatever was there before.
如有必要,您可以使用load
函数做更多的事情(例如传递数据和回调函数),因此,有关更多信息,我建议阅读
You can do more with the load
function if necessary (like pass in data, and a callback function), so for more information I suggest reading the load
section in the jQuery API.
这篇关于如何通过jQuery刷新一个div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!