在 MVC 帖子中使用 ajax 出现 500 错误,在本地工作

问题描述

我正在尝试保存预订信息,我已使用 ajax 来保存。

Ajax code

Function ajax

Controller

My view model

Getting the below error.

response text

html

保存按钮在表单标签内 甚至响应文本也不包含太多信息。 奇怪的是,它在本地完美运行,但在托管位置却无法运行。

更新:

modal

这是我的模态。

{BookingID: "0",title: "Test05",start: "30/12/2020 13:00 pm",end: "30/12/2020 15:00 pm",Description: "Test05", …}

但是记录的请求是

Time

时间正在进入认日期和时间。 有什么原因吗??

解决方法

尝试更改您的 ajax 调用: 而不是

var data=  {bookingViewModel:bookingViewModel};

使用:

var data=bookingViewModel; //(or data:bookingViewModel inside of ajax)