jquery - 尝试在 MVC 5 中使用 AJAX POST 将数据传递给操作方法
问题描述
我正在尝试从 Jquery 的 Bootbox 文本区域捕获注释/评论并将其发送到接受参数的操作方法,但我没有达到该操作方法的断点。
我在 View.cshtml 中的 jquery:
$(function () {
if ($('#stafId').is(':checked')) {
bootbox.prompt({
title: "Please add Project Note for STAF selection",
inputType: 'textarea',
callback: function (result) {
$.ajax({
type: 'POST',
url: '/Requirement/SaveProjectNotes',
data: { notes: result }
});
}
});
}
});
我在控制器中的操作方法:
[HttpPost]
public ActionResult SaveProjectNotes(string notes)
{
// TODO :
return RedirectToAction("Index", "Requirement", new { page = -1 });
}
我不知道为什么我没有使用 action 方法。任何指针都会有很大帮助。
TIA。
解决方案
推荐阅读
- angular - 无法创建 Angular 应用程序 http-server - 错误:css 和 js 文件 404 未找到
- firebase - 通过 API 更新 Firebase MLKit 自定义模型文件
- python - 使用 pdf 路径更新 QWebEngineView
- adobe - 无法通过 Adobe Launch 获取当前点击值
- c# - WPF - 无限数据网格高度
- javascript - 如何在谷歌地图中添加标记?
- jquery - 使用 Ajax 将图像从 User 发送到 Flask 进行分类
- google-kubernetes-engine - 如何为没有通配符的 GCE Ingress 提供正确的路径?
- vba - 使用 vbscript 提取电子邮件地址而不是 CC 的电子邮件名称?
- html - 如何用按钮内的图标替换文本?