单击确认按钮后,如何在同一文本框内显示文本?

时间:2019-04-23 05:30:24

标签: javascript sweetalert

我想在单击确认按钮后在相同的警告框中显示消息。我不知道怎么做。成功加载excel工作表后,我再次显示警告提示 “成功邀请”。但是,在我要在单击确认后在同一警报框中显示消息之前,直到它加载并调用其他警报。请帮我。

$('.uploadinvitee-btn').click(function(){
            swal({
                title: "Are you sure?",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#EF5350",
                confirmButtonText: "Yes",
                cancelButtonColor: "#ccc",
                cancelButtonText: "No",
                closeOnConfirm: false,
                closeOnCancel: true,
                showLoaderOnConfirm: true,
                text : "Please do not refresh the page",
                showTextOnConfirm : true
            },

            function(){
            var formData = new FormData( $('#uploadInvitee-form')[0]);
                //alert("please do not refresh page until the excel sheet loads completely...!!");
               // setTimeout(function() { alert("please do not refresh page until the excel sheet loads completely...!!"); }, 1000);
            $.ajax({
                url : baseURL+'InviteeUpload/uploadInvitees',
                type : 'POST',
                data : formData,
                //async : false,
                cache : false,
                contentType : false,
                processData : false,
                success : function(response) {
                    var result = JSON.parse(response);
                    if(result.result == 1){

                        swal({
                            title: "Success",
                            text: result.message,
                            confirmButtonColor: "#2196F3"
                        },
                        function(isConfirm){
                            if (isConfirm) {
                                window.location.href =baseURL+"event";
                            }
                        });
                    } else if(result.result == 0){
                        swal({
                            title: "Attention!",
                            text: result.message,
                            type: "warning",
                            showCancelButton: false,
                            confirmButtonClass: "btn-danger",
                            confirmButtonText: "Ok",
                            closeOnConfirm: true
                        });
                    } else {
                        swal({
                            title: "Oops!",
                            text: "Something went wrong! Please check the excel you have uploaded.",
                            type: "warning",
                            showCancelButton: false,
                            confirmButtonClass: "btn-danger",
                            confirmButtonText: "Ok",
                            closeOnConfirm: true
                        });
                    }
                }
            });
        });
    });

0 个答案:

没有答案