【发布时间】:2018-10-01 12:15:17
【问题描述】:
值显示在 Is Canceled = true 但复选框未选中。 任何人都可以告诉如何在 true 时编写代码,然后复选框选中,如果 false 则未选中。此代码无效。
function POGetby(PO_ID) {
$.ajax({
url: "/Home/POMain_Select",
type: "GET",
contentType: "application/json;charset=UTF-8",
data: { 'PO_ID': PO_ID },
dataType: "json",
success: function (result) {
if (!$("#IsUCancelled").is(":checked")) {
$('#IsUCancelled').val(result.IsCancelled);
}
$('#UpdateModel').modal('show');
$('#UpdatePO').show();
},
error: function (errormessage) {
alert(errormessage.responseText);
}
});
return false;
}
【问题讨论】:
-
$('#IsUCancelled').prop('checked',result.IsCancelled);希望#IsUCancelled 是您的复选框ID
标签: jquery json model-view-controller