Hello iam new to ajax so this question might sound simple to you..
let me explain what i did
There are the ones that i added in my header template
PHP Code:
<span style="cursor:pointer;font-size:8pt" onclick="javascript:window.location.href='<?php echo $VAR[0];?>/member/mail/';"><span id="OnAtAGlance">{%messagesOnline%}</span> new message(s)</span>
<script type="text/javascript">InitializeRefresh('<?php echo phpfox_links("ajax","messages"); ?>','100','OnAtAGlance');</script>
<span style="cursor:pointer;font-size:8pt" onclick="javascript:window.location.href='<?php echo $VAR[0];?>/member/friends/?action=requests';"><span id="OnAtAGlance">{%newfriends%}</span> new friend request(s)</span>
<script type="text/javascript">InitializeRefresh('<?php echo phpfox_links("ajax1","friendrequest"); ?>','100','OnAtAGlance');</script>
<span style="cursor:pointer;font-size:8pt" onclick="javascript:window.location.href='<?php echo $VAR[0];?>/<?php echo $VAR[4];?>/guestbook';"><span id="OnAtAGlance">{%scrapbook%}</span> scrap(s)</span>
<script type="text/javascript">InitializeRefresh('<?php echo phpfox_links("ajax2","scraps"); ?>','100','OnAtAGlance');</script>
<span style="cursor:pointer;font-size:8pt" onclick="javascript:window.location.href='<?php echo $VAR[0];?>/member/mail/?action=comment';"><span id="OnAtAGlance">{%alertbox%}</span> new alert(s)</span>
<script type="text/javascript">InitializeRefresh('<?php echo phpfox_links("ajax3","alert"); ?>','100','OnAtAGlance');</script>
Here is what that contains in ajax.php, ajax1.php, ajax2.php & ajax3.php
Ajax.php
case 'messages':
PHP Code:
$a = phpfox_mysql_query("SELECT `id` FROM `mail` WHERE `to` = '$VAR[4]' AND `type` = 'mail' AND `seen` = '1'");
$total = mysql_num_rows($a);
echo $total;
break;
case 'check_user':
$a = phpfox_mysql_query("SELECT `user` FROM `user` WHERE `user` = '$_GET[item]'");
$b = mysql_fetch_array($a);
if ( !$b['user'] )
{
print checkLayout();
}
else
{
print checkLayout(sprintf($phpfox_lang['already_member'],$b['user']));
}
break;
The other files are same except that the case and the mysql query gets changed
Now what happens is, when i run it only the first one i.e {%messagesOnline%} is getting refreshed and is getting all the other values of friendrequest, scraps and alerts. but the other things remain unchanged
So only the first one is getting refreshed with the values..
But i want all the other ones to get refreshed and show the updated values from the database
Please help me..
p.s i have attached the main.js file