不要通过ajax实时通话删除

When i press the delete button, it won't delete the content. I think there is something wrong on the ajax delete call

ajax-file.php

    $('.delete_update').live("click",function() {

        var ID = $(this).attr("id");
        var dataString = 'msg_id='+ ID;

        if(confirm("Sure you want to delete this update? There is NO undo!")) {

        $.ajax({
            type: "POST",
            url: "delete_data.php",
            data: dataString,
            cache: false,
            success: function(html){
            $("div#bar"+ID).slideUp('slow', function() {$(this).remove();});
        }
    });

    }

return false;
});

<div class="accordionButton" id="bar<?php echo $msg_id; ?>"><?php echo $msg_id; ?>:<?php echo $name; ?>
<a href="#" id="<?php echo $msg_id; ?>" class="delete_update">X</a>
</div>
<div class="accordionContent" style="display: block;"><?php echo $msg; ?></div>

delete_data.php

<?php
include("db.php");
if($_POST['msg_id'])
{
$id=$_POST['msg_id'];
$id = mysql_escape_String($id);
$sql = "delete from messages where msg_id='$id'";
mysql_query( $sql);
}
?>

If you are using latest jQuery then use on instead of live as it's not supported

*Updated for dynamic content

$(document).on("click", '.delete_update', function() {

I think the problem is within this function. You're giving $.ajax data object a string. The function 'normally' only processes javascript objects.

Also be carefull when processing parameters without checking them. Have a look at prepared statements for mysql.

    $.ajax({
        type: "POST",
        url: "delete_data.php",
        data: dataString, <--- May be wrong because you are using POST
        cache: false,
        success: function(html){
        $("div#bar"+ID).slideUp('slow', function() {$(this).remove();});
    }

Try this instead. Try to echo msg_id at the service side script

    $.ajax({
        type: "POST",
        url: "delete_data.php",
        data: {msg_id:ID},
        cache: false,
        success: function(html){
        $("div#bar"+ID).slideUp('slow', function() {$(this).remove();});
    }