ajax文件中的mysql查询未执行。 努力处理错误报告

I have a problem with Ajax. I've pasted my code below.

I have some jquery that listens for a click and then fires the ajax, but my ajax isn't working. The Javascript works fine, because the currentTODO.fadeOut('fast'); piece of code after I call the ajax works.

I'm not sure if the problem lies in the MySQL query, and I am also struggling with checking and reporting on any errors that come from my ajax.php file.

I must add that I am quite new to ajax, and I copied the original code from here: http://tutorialzine.com/2010/03/ajax-todo-list-jquery-php-mysql-css/

But I had to make so many changes to the code to get it to work correctly in my environment and fulfill my needs.

Javascript:

$("#dialog-confirm").dialog({
    resizable: false,
    height:130,
    modal: true,
    autoOpen:false,
    buttons: {
        'Delete item': function() {
            $.get("ajax.php",{"action":"delete","id":currentTODO.data('id')},function(msg){
                currentTODO.fadeOut('fast');
            })

            $(this).dialog('close');
        },
        Cancel: function() {
            $(this).dialog('close');
        }
    }
});

    $('.todo a.delete').on('click',function(){
    $("#dialog-confirm").dialog('open');
    });

code in ajax.php

<?php
class ToDo{
    public static function delete($id){
        mysql_query("UPDATE Todo SET StatusID = 6 WHERE TodoID=".$id);

        if(mysql_affected_rows($GLOBALS['link'])!=1)
            throw new Exception("Couldn't delete item!");
    }
}

$id = (int)$_GET['id'];

try{
    switch($_GET['action'])
    {
        case 'delete':
        ToDo::delete($id);
        break;
    }
}
catch(Exception $e){
    echo $e->getMessage();
    die("0");
}
echo "1";
?>

Your help will be greatly appreciated. Please let me know if you require any additional information from me.

Try this,

$.get("ajax.php",{action:"delete",id:currentTODO.data('id')},function(msg){
     //____________^______________^___________________________
     currentTODO.fadeOut('fast');
})