Page 1 of 1

Updating Table

Posted: Thu Aug 12, 2010 4:01 pm
by staggan
Hello

I am trying to update a table without having to update the whole page...

This is the table...

<div id="FriendsTable">

<table id="friendslist" width="730" border="0" background="XXXXXX">
<tr>
<td width="75"><a href="#" onclick="downlist()"><img src="XXXXXXX" width="38" height="38" alt="Left" /></td>
<td width="75"><? echo $friendsslice[0]; ?></td>
<td width="75"><? echo $friendsslice[1]; ?></td>
<td width="75"><? echo $friendsslice[2]; ?></td>
<td width="75"><? echo $friendsslice[3]; ?></td>
<td width="75"><? echo $friendsslice[4]; ?></td>
<td width="75"><a href="#" onclick="uplist()"><img src="XXXXX" alt="right" width="38" height="38" align="Right" /></td>
</tr>
</table>

</div>

Essentially what I am trying to do is have a table of friends names, and in that table show a slice of those friends, and with a click of the left / right button, move that slice up and down through my complete list of friends.....

On clicking the left or right button I call a small javascript function... which uses PHP to give me a new slice of my overal friends list...

<script type="text/javascript">
function uplist()
{
<?
$friendsslice = array_slice ($friends, ($list_start+=1), ($list_end));
tableRefresh();
?>
}
</script>

I have a function called tableRefresh() set aside to refresh the table content after a new slice has been selected.. but I have no idea how to actually make that function...

Any ideas?

Thanks

Re: Updating Table

Posted: Thu Aug 12, 2010 4:05 pm
by Sephern
Look into AJAX.