This is my code
<script>
$(document).ready(function() {
// delete the entry once we have confirmed that it should be deleted
$('.delete').click(function() {
var parent = $(this).closest('tr');
$.ajax({
type: 'POST',
url: 'delete.php',
data: 'ajax=1&delete=' + $(this).attr('id'),
success: function() {
parent.fadeOut(300,function() {
parent.remove();
});
}
});
});
$('.delete').confirm({
});
});
</script>
My question is why delete.php is not executing? It’s in the same folder, do I need type absolure url to this file? But the best of it is that row in table is deleting, but php file is not executing.
And second question is why this code is not working without this line:
$('.delete').confirm({
});
In php file i got this to know is it executed:
<script>
alert('aaaa');
</script>
Or even I had change it on echo 'something'; but still not working
If the row is deleted the certainly the php file is executed and you have to check the url data as @Saifuddin has described.
use firebug console to see your result. and also you are not passing parameter to the success function
so change this
and also this