I have this but is not working which is a mixed of both answers found here (http://stackoverflow.com/questions/10369432/passing-link-with-parameters-with-jquery)... the alert message comes out empty and therefore the delete.php doesn't do anything
Any comments. I am using JQuery 1.8
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(function(){
$(".delete").click(function(e){
var del_id = $(this).attr("id");
e.preventDefault();
$.post("../folder/delete.php", { iid: del_id } ,function(data){
alert(data)
//change the link to deleted
$('#'+del_id).replaceWith('<a href="#" class="delete">Deleted</a>');
});
});
});
</script>
</head>
<body>
<a class="delete" id="1" href='#'>Delete 1</a>
<a class="delete" id="2" href='#'>Delete 2</a>
<a class="delete" id="3" href='#'>Delete 3</a>
</body>
</html>
Delete.php is as follows:
<?php
extract($_POST);
extract($_GET);
if ($del_id!=0){
require_once("../includes/include.php");
deleteItem($del_id);
}
?>