JQuery弹出MVC 4中不起作用的必要字段验证
[Display(Name = "Material Code")][Required(ErrorMessage = "*")]public string MaterialCode { get; set; }<li> @Html.LabelFor(m => m.MaterialCode) @Html.TextBoxFor(m => m.MaterialCode) @Html.HiddenFor(m => m.MaterialCodeId)</li>
$('#btnAddCharge').on('click', function (event) {
event.preventDefault();
var actionURL = '@Url.Action("Edit", "Charges", new { Id = 0, @ticketId = @TicketId, UserId = UserId })';
$(dialogBox).dialog({
autoOpen: false,
resizable: false,
title: 'Edit',
modal: true,
show: "blind",
width: 'auto',
hide: "blind",
open: function (event, ui) {
$(this).load(actionURL, function (html) {
$('form', html).submit(function () {
$.ajax({
url: this.action,
type: this.method,
data: $(this).serialize(),
success: function (res) {
if (res.success) {
$(dialogBox).dialog('close');
}
}
});
return false;
});
});
}
});
$(dialogBox).dialog('open');
});侃侃尔雅
红糖糍粑
相关分类