我有以下jquery函数:
function SaveMail() {
subject = $("#MailMsgSubject").val();
message = $("#MailMsgMessage").val();
to = To;
cc = Cc;
$.ajax({
type: "POST",
data: JSON.stringify({ subject: subject, message: message, listTo: to, listCc: cc }),
url: '@Url.Action("SaveNewMail", "Mail")',
contentType: "application/json; charset=utf-8",
success: function (data) {
$("#SuccesDiv").html("<b>Your message has been succesfully sent</b>");
}
});
}
我有以下观点:
<div style="float: left">
Subject :
</div>
<div style="float: left; width: 30.5%">
@Html.TextBoxFor(modelItem => Model.Subject, new { id = "MailMsgSubject", @style = "width:99%" })
</div>
<div style="clear: both" />
<div style="float: left">
Priority :@Html.EditorFor(modelItem => Model.Priority, new { id = "MailMsgPriority" })
</div>
<div style="float: left">
Return Receipt :@Html.EditorFor(modelItem => Model.ReturnReceipt, new { id = "MailMsgRR" })
</div>
<div style="float: left">
Patient :@Html.TextBoxFor(modelItem => Model.Priority, new { id = "MailMsgPatient" })
</div>
<div style="clear: both" />
<div style="float: left">
Message :
</div>
<div style="clear: both" />
<div style="float: left; width: 35%">
@Html.TextBoxFor(modelItem => Model.Message, new { id = "MailMsgMessage", @style = "height: 220px; width:100%" })
</div>
<p style="text-align: right">
<input type="button" id="btnSaveMailMessage" />
</p>
我的问题是将此处的 2 个复选框(优先级和回执)的值传递给我的 JQuery 函数。EditorFor 正如我最近发现的那样(艰难的方式)在接受一组 ID 时有问题 有
任何解决方案吗?提前致谢 !
如何将这些值传递给我的 Ajax,称为控制器方法“SaveNewMail”