コンテンツが更新されると、PHPinclude
と jQueryで問題が発生し、onload
<li>
onload
include function
以下のように私のコード:
<li class="dropdown">
<a href="#" data-toggle="dropdown" ><img src="style/img/notification.png" /></a>
<ul style="overflow:sauto; width:300px; overflow:auto;" class="dropdown-menu">
<?php include("inc/noti_refresh.php"); ?>
</ul>
</li>
ここに私のnoti_refresh.php
:
<?php include("configa.php");
$me = $_SESSION['username'];
$noti = mysql_query("select * from notification where to_user = '$me' order by id DESC ");
//$rown = mysql_num_rows($noti);
while ($notime = mysql_fetch_array($noti)){
$me = $notime['to_user'];
$you = $notime['from_user'];
$p_id = $notime['p_id'];
$type = $notime['type'];
$uimage = mysql_query("select * from users where username = '$you'");
$uname = mysql_fetch_assoc($uimage);
$myimage = $uname['img'];
//if( $rown !=0) {
?>
<li class="ref"><a href="photo/<?php echo $p_id; ?>"><img src="users/<?php echo $myimage; ?>" style="height:32px; width:32;" /> <?php echo $you; ?> Has <?php echo $type; ?> Your Image </a></li>
<li class="divider"></li>
<?php }?>
これは私のjQuery関数です:
<script type="text/javascript">
function Load_external_content()
{
$('.ref').load('inc/noti_refresh.php').hide().fadeIn(3000);
}
setInterval('Load_external_content()', 10000);
</script>
が更新されるたび<li class="ref">
に、結果が重複して表示されるようになりました。
誰でも助けてもらえますか?