7
我有一个控制器操作,它将一些JSON结果返回给jQuery Full Calendar插件。如果出现错误,我会返回HTTPStatusCodeResult
自定义错误消息,但是我无法获取要显示的自定义错误消息。一切都显示在警告框,这是默认的HTTP状态(即:“禁止”或“内部服务器错误”)HTTPStatusCodeResult&jQuery的自定义错误消息
控制器代码,返回的错误信息
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);
}
},
我不知道为什么微软有** NOT **修正了这个问题。今天我花了一个多小时或更多时间试图看看我做错了什么。 – vcRobe 2017-03-30 17:25:41
我不知道现在有多少工程师在VS Web开发服务器上工作?我的猜测是0 – MrBliz 2017-03-30 17:30:52