Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ajax jquery中的陷阱消息/异常到ELMAH_Ajax_Json_Asp.net Mvc 3_Exception Handling_Elmah - Fatal编程技术网

Ajax jquery中的陷阱消息/异常到ELMAH

Ajax jquery中的陷阱消息/异常到ELMAH,ajax,json,asp.net-mvc-3,exception-handling,elmah,Ajax,Json,Asp.net Mvc 3,Exception Handling,Elmah,在我的MVC3应用程序中,我从存储的进程返回消息。如果它是“成功的”,我将继续显示一个自定义错误页面。 当信息是其他东西时,我想把它困在ELMAH里。我所面临的问题是,返回消息并不是一个真正的错误,所以我不知道如何处理它。在ELMAH中捕获错误后,我仍然希望显示自定义错误页面。 请帮忙 $.ajax({ url: "../XYZ", type: 'POST', dataType: 'text', async: false,

在我的MVC3应用程序中,我从存储的进程返回消息。如果它是“成功的”,我将继续显示一个自定义错误页面。 当信息是其他东西时,我想把它困在ELMAH里。我所面临的问题是,返回消息并不是一个真正的错误,所以我不知道如何处理它。在ELMAH中捕获错误后,我仍然希望显示自定义错误页面。 请帮忙

$.ajax({
        url: "../XYZ",
        type: 'POST',
        dataType: 'text',
        async: false,
        data: JSON.stringify({ abcData: abcData, strDeb: strDeb, strCre: strCre }),
        contentType: 'application/json; charset=utf-8',
        success: function (data) {
            if (logout != "Logout") {
                if (data.toLowerCase() != "successful") {
                    **//alert(data.toString());
                    window.location.href = "../Error";**
                } else {
                    window.location.href = "../ABC";
                }
            }
        },
        error: function () {
            var sessionWindowElement = $('#SessionLayoutLogOutWindow');
            sessionWindowElement.data('tWindow').center().open();
        }
    });

请看前面的问题-在这里找到解决方案:谢谢@PaigeCook…这篇文章让我走上了正确的道路!