JS确认更改为Jquery Modal Dialog

时间:2012-11-22 09:35:51

标签: javascript jquery modal-dialog

我现在有一个模态删除确认我想更改确认以使用jQuery Modal。这是我的:

$('.stdelete').live("click", function() {
    var ID = $(this).attr("id");
    var uid = $("#uid").val();
    var dataString = 'msg_id='+ ID + '&uid=' + uid;

    if (confirm("Sure you want to deletes this update? There is NO undo!")) {
        $.ajax({
            type: "POST",
            url: "delete_message_ajax.php",
            data: dataString,
            cache: false,
            success: function(html) {
                $("#stbody"+ID).slideUp();
            }
        });
    }

有人有想法吗? 谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

    $('.stdelete').live("click",function()  {
        var ID = $(this).attr("id");
        var uid = $("#uid").val();
        var dataString = 'msg_id='+ ID + '&uid=' + uid;
        var d = $('<div />').append('Sure you want to deletes this update? There is NO undo!').dialog({
            buttons: {
                'no': function() {
                    $(this).dialog('close');
                },
                'yes': function() {
                    $.ajax({
                        type: "POST",
                        url: "delete_message_ajax.php",
                        data: dataString,
                        cache: false,
                        success: function(html){
                            $("#stbody"+ID).slideUp();
                        }
                    });
                    $(this).dialog('close');
                }
            }
        });
        $('body').append(d);
    });