hi there pals.

i am writing some codes for a scaffolding application. consider i want to implement :
[IMG]http://ce.sharif.edu/~zamanian/untitled.JPG[/IMG]

when user click in Delete Link, DB delete that row and make it disappear from the page with Ajax.
i put the whole table on one DIV , and i want the program to refresh only this div (and not other div in the screen) as soon as user click on the DELETE link.
i writes my codes in Symfony Gramework, but it doesnt matter for now.
i can pass the Row_id to the deleteFunction , and delete it from the DB. but i can make it vanished from the screen. because the Ajax link is in the Div itself.
Thanks for your helps in advance

You can not refresh the div element alone. You can make the require change in div element, dynamically using JavaScript, which is like refreshing the div.

I think this is what u was seeking:

This code shows to delete row from a table.

<html>
	<head>
		<title>test</title>
		<script type="text/javascript">
			
			// This code should be in the success handler of your Ajax call
			function deleteRow(el) {
				var tEl = document.getElementById('mytable');
				var rEl = el.parentNode.parentNode;
				alert("deleting row: " + rEl.rowIndex);
				tEl.deleteRow(rEl.rowIndex);
			}
		</script>
		
		<style>
			
		</style>		
	</head>
	
	<body >
		<div id="slider">
			<table id='mytable' border='1'>
				<tr>
					<th>S.No.</th><th>Data</th><th>Action</th>
				</tr>
				<tr>
					<td>1.</td><td>d_1</td><td><a href='#' onclick='deleteRow(this);'>Delete</a></td>
				</tr>
				<tr>
					<td>2.</td><td>d_2</td><td><a href='#' onclick='deleteRow(this);'>Delete</a></td>
				</tr>
				<tr>
					<td>3.</td><td>d_3</td><td><a href='#' onclick='deleteRow(this);'>Delete</a></td>
					
				</tr>
			</table>
		</div>
		
	</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.