I have a "Delete Account" link. I want to show a dialog box confirmation when this link is clicked.

See: http://jsfiddle.net/jPzj6/

The problem is that in this code, the confirmation "Are you sure you want to delete your account?" is already showing.

I also want to show the dialog box with the Delete button linking to:

window.location = bender.base_url + '?page=user&action=delete&id=' + bender.user.id  + '&secret=' + bender.user.secret;

and the Close button to simply close the dialog box.

I wanted to make it look like this: http://jsfiddle.net/taditdash/vvjj8/

Would really appreciate any help. Thanks!

有帮助吗?

解决方案

You should just copy code from example. Your code has lack of buttons identifiers

    buttons: {
        "Yes": function () {
            $(this).dialog('close');
            callback(true);
        },
            "No": function () {
            $(this).dialog('close');
            callback(false);
        }
    }

and for some reason, in your code buttons is array and in example it is object. Also, you have undefined value of bender, you should create object before fill it

var bender = {};
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top