Hi jbennet,
Go download the latest version of JQuery (http://jquery.com/) and include this (the downloaded file) in the '<head>' of your site.
Next, create a file called delete.js file with the following 'post' request - and include it on your page.
function delete_item(id) {
/* Post the id of the item you want to delete */
$.post("action.php", { delete_id: id },
function(data) {
/* Receive the data from your php file */
var db_response = eval('(' + data + ')');
/* Alert the response */
alert(db_response[0]);
});
}
Then create a file called action.php file that handles the deletion of your items. The output from this file will be picked up by the delete.js file, so you can either show a success or an error message.
/* Delete your item using a MySql statement, then output one of the following: */
/* Success! */
//echo json_encode( array('success') );
/* Error :( */
//echo json_encode( array('error') );
Then put it all together like this:
<html>
<head>
<!-- This is the JQuery file you downloaded -->
<script type="text/javascript" src="jquery-1.5.min.js"></script>
<!-- This is your file that posts a request to your php file -->
<script type="text/javascript" src="delete.js"></script>
</head>
<body>
<a href="#" onclick="delete_item(2); return false;">Click here</a> to delete item #2
</body>
</html>
I hope this helps you out.
Jim :)