jQuery对话框

I have a delete button where on clicking the button i want a dialog box to pop up and then on clicking ok it should do the Ajax call else shouldnt do anything. here is Code

$('.comment-delete').click(function () {
    var deleteID = $(this).attr('id');

    $.ajax({
        url: "account/deleteComment/" + deleteID,

        success: function () {
            $("#comment-"+deleteID).slideUp("fast");
        }

    });

    return false;
});
if (confirm("Your question")) { 
    $.ajax({
        url: "account/deleteComment/" + deleteID,
        success: function () {
            $("#comment-"+deleteID).slideUp("fast");
        }
    });
} 

Are you asking a question? I assume it's not working for you. I don't think you're passing the variables correctly. Take a look at jQuery.get(), that may be suitable for what you're trying to do.

You can do the dialog confirm with just a single extra line of code.

$('.comment-delete').click(function () {

    // Confirm Dialog.
    if (!confirm('Do you really want to delete?')) return false;

    var deleteID = $(this).attr('id');

    $.ajax({
        url: "account/deleteComment/" + deleteID,

        success: function () {
            $("#comment-"+deleteID).slideUp("fast");
        }

    });

    return false;
});