AJAX不干扰处理失败消息

问题描述

我正在.net核心剃刀视图上使用AJAX Unobtrusive,如下所示。.在我的控制器内,我有不同的if语句,并且在发生异常的情况下,我想使用甜蜜警报向用户返回不同的自定义错误消息。

感谢您的帮助。

查看:

 <form id="FastScan" asp-action="ScanIt" asp-controller="IReconcilation" data-ajax="true" data-ajax-success="ScanSuccess" data-ajax-failure="ScanError" data-ajax-loading="#spinLoader1" class="form form-horizontal" method="post">

......

</form>

脚本:

function ScanError() {
        Swal.fire({
            title: "some title",text: "message goes here",type: "error",confirmButtonClass: 'btn btn-primary',buttonsstyling: false,});

和我的控制器方法

public void ScanIt(MDVM model)
        {
            try
            {


                if ( something)
                {
                    //redirect to error but dont kNow how to pass my custom error message to the sweet alert
                    throw new Exception();
                }


.......

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)