I've a jquery script to remove articles from a shopping cart:
<script type="text/javascript">
$(document).ready(function(){
$(".deleteLink").click(function(e) {
e.preventDefault();
var id = $(this).attr('data-id');
$.ajax({
type: 'POST',
url: 'delete.php',
data: "id=" +id
})
.done(function(data){
alert("Deleted.");
var url="basket.php";
$("#warenkorb").load(" #warenkorb > *");
})
.fail(function() {
alert("Error");
});
return false;
});
});
</script>
This works when I enter the page and click on a Delete-Link. When I click on the second link it does not work anymore. I have to reload the page. Then I can delete again exactly once.
The Link looks like this:
<a class="deleteLink" data-id="$id" href="#">Delete</a>
Could anybody imagine what the problem could be?