Hi,
I am working on a ajax add/remove record method using html/ajax/javascript (front end) and scenario works like this:
1. Form is displayed and table is displayed

2. When user enters data into the form through the ajax call the table the record is added to the database and new row is added into the front end of page without page refresh.

3. When deleting the row user selects the checkbox from the table showing in the front end and then click delete. The ajax function is invoked to delete the selected row from the table but I need to remove the row also from the front end and issue is like this:

First database ajax call is made to remove the row and my .php program returns success or failure string then in ajax callback method i.e.
Code:
request.onreadystatechange=removeCustomer;
in remove customer callback method I want to remove the corresponding row from the table. How can I get the selected table row in the call back method(In other words how does my ajax callback method request.onreadystatechange=removeCustomer; know which table to remove from the front end dynamically.

The partial code is:
Code:
function removefromDB()
{
	alert('Inside Delete Cust');
	request=createRequest();
				if(request==null)
				{
					alert("Unable to Delete data from the database Please try again later");
					return;
				}
				else
				{
					try {
							var table = document.getElementById("customertable");
				             var rowCount = table.rows.length;
 
							for(var i=0; i<rowCount; i++) 
							{
								 var row = table.rows[i];
								 var chkbox = row.cells[0].childNodes[0];
									if(null != chkbox && true == chkbox.checked) 
									{
					                    var cname=row.cells[1].innerText;
										var add1=row.cells[2].innerText;
										var add2=row.cells[3].innerText;
										var city=row.cells[4].innerText;
										var url="removeCustomer.php";
										var requestData="cname=" + 
										escape(document.getElementById("cname").value) + "&add1=" +
										escape(document.getElementById("add1").value) + "&add2="  + 
										escape(document.getElementById("add2").value) + "&city="  +
										escape(document.getElementById("city").value);
										request.onreadystatechange=removeCustomer;
										request.open("POST",url,true);
										request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
										request.send(requestData);
										table.deleteRow(i);
										rowCount--;
										i--;
									}
							}
					}
					catch(e)
					{
		                alert(e);
				    }
					

				}
}
Any suggestions would be highly appreciated on this part.

Thanks
PHPnewbie