我有一个控制器动作,它将一些
JSON结果返回给jQuery Full Calendar插件.如果出现错误,我返回带有自定义错误消息的HTTPStatusCodeResult,但是我无法显示自定义错误消息.警报框中显示的所有内容都是默认的Http状态(即:’Forbidden’或’Internal Server Error’)
else if(id != CurrentUser.UserId) { return new HttpStatusCodeResult(403,"You are not authorised to view this."); } else { return new HttpStatusCodeResult(500,"There was an error on the server."); }
jQuery代码
$(document).ready(function () { $('#calendar').fullCalendar({ header: { left: 'prev,next today',center: 'title',right: 'month,agendaWeek,agendaDay' },height: 600,eventSources: [{ url: events,type: 'Get',error: function(response,status,error) { alert(response.statusText); } }],allDayDefault: false,selectable: true,eventClick: function (event) { if (event.url) { $('#details').load(event.url); } },
解决方法
原文地址:https://www.jb51.cc/csharp/100946.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。