How to post the value of checkbox in ajax call

i retrieved data from mysql table into html page i.e

$query="select * from student";
$result=mysql_query($query)or die(mysql_error());
while($rs=mysql_fetch_array($result))
{
?>
<tr>
      <td align="center"><?php echo $rs['st_id']; ?></td>
<td align="center"><?php echo $rs['name']"; ?></td>
<td align="center"><input type="checkbox" name="check" <?php if($rs['checked']==1){echo "checked"; } ?> /></td>
<td align="center"><a href="delete_student.php?id=<?php echo $rs['st_id'];?>"><img src="images/delete_icon.png" alt="Delete" /></a></td>
<td align="center"><a href="update_student.php?id=<?php echo $rs['st_id'];?>"><img src="images/update.png" alt="Update" /></a></td>
</tr>

this is gives me the output

assume that checkbox of id 1 is checked and retrieved from mysql table.
<br /> Now what i want to do is that when i checked the remaing two checkbox into this table and a function is called to ajax which goes to php page and update the value of checked field according to the given id (i.e 2 and 3 in this case). Not refreshing the whole page nor updating the whole record just the value of check box.<br/> i am new to ajax so
any help would be greatly appreciated.

Do you need help with the PHP script that’ll update the MySQL table?
Or with the javascipt part that has to call the PHP script, send it the relevant data and receive the response?

i need help in javascript part cause i am new to ajax, i don’t know how to call ajax when i click on specific checkbox with relevant st_id and then how ajax call the php script.

Ok, I’ll ask for this post to be moved to the javascript forum, that way you’ll have more possibility to get a quick and good answer.

The technique you are wanting to use is where the onchange event of the checkbox is used to both perform the ajax request to the database, and to replace the update button with an animated updating icon until a successful response from the server is received.

Does your web page already use any javascript library, such as jQuery, so that you can leverage off of that pre-existing library to make your life a lot simpler?

No there is no jQuery library in my page there should be onclick or onchange event on my checkbox.

We’ll use the onclick event so that the event occurs as soon as you click on it.

I have to go now, but if you want some guidance on how it’s done, there is a very good resource on performing ajax updates, in the book Bulletproof Ajax which also freely provides the [url=“http://bulletproofajax.com/code/”]code examples and working demos.