Fullcalendar事件丢弃和ajax

我目前正在使用伟大的Jquery插件 – Fullcalendar,但我遇到了一个问题。 我使用eventDrop监听器,我想使用Ajax将事件信息发送到我的服务器端。

我的代码如下:

eventDrop: function (event, dayDelta) { $.ajax({ url: ("/PSAdmin/RFCalendar/DragEvent"), data: ({ type: event.className, delta: dayDelta, newDate: event.start, newTitle: event.title }), type: "POST", success: function (data) { $('#calendar').empty(); loadCalendar(); }, error: function (xhr, status, error) { alert("fail"); } }); } 

我的问题是,只要我尝试发送包含在事件对象中的任何变量,它就不起作用。 例如,只将dayDelta发送到服务器端,但没有event.something。

如果有人在此之前发现了这个问题,或者你知道可能导致问题的原因,请告诉我。

所以不幸的是,我无法弄清楚为什么ajax查询无法正常工作,我不得不做我最初不想做的事情。

 if (event.className == "holiday") { var className = "holiday"; } //build date var date = event.start.getMonth()+1 + "/" + event.start.getDate() + "/" + event.start.getFullYear(); alert(date); $.ajax({ url: ("/PSAdmin/RFCalendar/DragEvent/"), data: ({ className: className, delta: dayDelta, newDate: date, newTitle: event.title }), type: "POST", success: function (data) { $('#calendar').empty(); loadCalendar(); }, error: function (xhr, status, error) { alert("fail"); } }); 

这是丑陋和耗时,但至少它的工作原理。 我还有其他优先事项,但如果您对此问题有任何疑问,请告诉我。

谢谢,格雷格

迟到的答案,但我有一个类似的问题,没有任何东西被发送到服务器。 尝试了一切,缓存以及使用jquery来扩展和复制对象。

对我来说有用的是查看标题,以满足请求。 他们似乎总是有数据。

我最终得到了这个代码服务器端。 不是我想要的,但它可能有助于有人试图解决同样的问题!

C#

 [HttpGet] public void UpdateOrderData(object orderObj) { var obj = new { start = System.Web.HttpUtility.UrlDecode(HttpContext.Current.Request.QueryString["orderObj[start]"]), end = System.Web.HttpUtility.UrlDecode(HttpContext.Current.Request.QueryString["orderObj[end]"]), date = System.Web.HttpUtility.UrlDecode(HttpContext.Current.Request.QueryString["orderObj[date]"]), resourceId = System.Web.HttpUtility.UrlDecode(HttpContext.Current.Request.QueryString["orderObj[resourceId]"]), orderId = System.Web.HttpUtility.UrlDecode(HttpContext.Current.Request.QueryString["orderObj[orderId]"]), }; calendarUnitOfWork.CustomDataRepository.UpdateOrderData(obj); } 

使用Javascript

  myModel.eventDrop = function(event, delta, revertFunc, jsEvent, ui, view ) { calUOW.orderrepository.updateOrderData({ start: event.start.format(), end: event.end.format(), date: event.start.format("YYYY-MM-DD"), resourceId: event.resourceId, orderId: event.orderId }); }