如何使用甜蜜警报回滚

时间:2018-08-30 04:53:06

标签: javascript asp.net vb.net sweetalert

如何在保存/删除期间使用甜蜜警报进行提交和回滚

我无法获取后面代码的confirm_value。我不了解使用ajax

任何人,请帮助。非常感谢。

JS:

function myfunction(sMsgTitle, sMsg, sRecordID, sAction, bCancelBtn) {
  
    var boolean = bCancelBtn.toLowerCase() == 'true' ? true : false;

    var confirm_value = document.querySelector('[name="confirm_value"]');
    if (!confirm_value) {
        var confirm_value = document.createElement("INPUT");
        confirm_value.type = "hidden";
        confirm_value.name = "confirm_value";
        document.forms[0].appendChild(confirm_value);
    }

    if (boolean == false) {
        swal(sMsgTitle, sMsg, "info")
    } else {
        swal({
            title: sMsgTitle,
            text: sMsg,
            type: "info",
            showCancelButton: boolean,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes",
            cancelButtonText: "No",
            closeOnConfirm: false,
            closeOnCancel: false,
        },
         function (isConfirm) {
             if (isConfirm) {
                confirm_value.value = "Yes";
                if (sAction == "INSERT") {
                    swal("", "Please fill in required info.", "success");
                } else if (sAction == "DELETE") {
                    swal("", "Record deleted successfully.", "success");
                } else if (sAction == "SAVE") {
                    swal("", "Record save successfully.", "success");
                }
             } else {
                confirm_value.value = "No";
                swal("", "Cancel", "error");
                uTrans.Rollback()
            }
        });
    }
}

0 个答案:

没有答案