hi guys even i have success delete the message return false delete message(“could not delete”) besides success delete messege but query is wokrking
please tell me what i am doing wrong here is my codes \
delete.php
if(isset($_POST['delete_id']) && !empty($_POST['delete_id'])) {
$delete_id = mysql_real_escape_string($_POST['delete_id']);
$query=mysql_query("DELETE FROM color WHERE idColor='$delete_id'");
if($query != false) {
echo 'true';
}
mysql_close();
<script>
$(document).ready(function(){
$('.del_btn').click(function(){
if (confirm("Are you sure you want to delete this Color?"))
var del_id = $(this).attr('rel');
$.post('script/delete_color.php', {delete_id:del_id}, function(data) {
if(data == 'true') {
$('#'+del_id).remove();alert('Color has been deleted!');
}
else {
alert('Color could not delete!');
}
document.messages.submit();
return false; // This line added}
});
});
});
</script>
I didn’t really understand your problem, but I’m going to take an educated guess…
You need to wrap your logic inside the “confirm” IF statement. Also, you had an extra “});”.