Ajax.BeginForm OnBegin confirmation Via jquery modal

后端 未结 3 393
误落风尘
误落风尘 2021-01-06 08:03

I\'m using jQuery UI dialog. I have a delete form as follows:

@using (Ajax.BeginForm(\"DeleteUser\", \"Administrator\", new { id = Model }, new AjaxOptions {         


        
3条回答
  •  花落未央
    2021-01-06 08:09

    A trick. This is my first post, i spend a lot of time to resolve this question, i think that this is easier:

     dialog:
    
    function smOpenConfirmDialog(callBack) {
    $("#noticeDialog").dialog({
        autoOpen: true,
        modal: true,
        autoOpen: false,
        draggable: false,
        buttons: {
            "Confirm": function () {
                callBack();
                $(this).dialog("close");
            },
            "Cancel": function () {
                $(this).dialog("close");
            }
        }
    });
    

    and

       $("input:submit").click(function (e) {
            smOpenConfirmDialog(function () {
                $("form").trigger('submit');
            });
            e.preventDefault();
        });   
    

提交回复
热议问题