【发布时间】:2020-05-22 09:52:21
【问题描述】:
描述
使用触发器,我调用了一个函数,该函数检索局部视图并将其放入代码中的位置 (作品)
我调用这个函数来显示表格
function getTable() {
var test= t6est;
var test2test= edhwbtest;;
if (test!= null && test2test!= null) {
var testFtT= daysInMonth(test, test2test);
$.ajax({
url: "@Url.Action("PartialTabelaEcp", "Home")",
type: "GET",
contentType: 'application/json; charset=utf-8',
dataType: "html",
data: { testFtT: testFtT, test: test, test2test: test2test},
cache: false,
success: function (data) {
$("#kartaEcp").html(data);
},
failure: function (error) {
alert(error);
},
error: function (error) {
alert(error);
}
});
}
}
还有这个控制器:
[HttpGet]
public ActionResult PartialTabelaEcp(int testFtT, int test, int test2test)
{
return PartialView("_TabelaEwidencja");
}
- 我需要从httpget改为httpppost,因为我需要将数据发送到数据库
但是当我改变时
$.ajax({
type: "GET",
and
[HttpGet]
public ActionResult
到
$.ajax({
type: "POST",
and
[HttpPost]
public ActionResult
错误
加载资源失败:服务器响应状态为 500(内部服务器错误)
【问题讨论】:
-
是否有关于该错误的更多详细信息(如果您在本地运行,请打开详细错误)。您能否在
[HttpPost]操作中添加断点以查看它是否被击中。 500 表示该动作正在被击中,但之后的某些东西正在破坏它。
标签: c# asp.net ajax asp.net-mvc asp.net-core