I have two checkboxes that I want to know by the database if they need to tick or not.
This is My HTML Code :
<div class="form-group">
<label for="MailServerRequiredSSL">وضعیت SSL سرور ایمیل</label>
<input type="checkbox" class="form-control" id="MailServerRequiredSSL"/>
</div>
<div class="form-group">
<label for="MailServerActive">وضعیت فعالیت سرور ایمیل</label>
<input type="checkbox" class="form-control" id="MailServerActive"/>
</div>
I am receiving and sending this data by Jquery AJAX.
function GetByID(MailServerID) {
$.ajax({
url: "GetByID?MailServerID=" + MailServerID,
typr: "GET",
contentType: "application/json;charset=UTF-8",
dataType: "json",
success: function (result) {
$('#MailServerRequiredSSL').val(result.MailServerRequiredSSL);
$('#MailServerActive').val(result.MailServerActive);
},
error: function (errormessage) {
alert(errormessage.responseText);
}
});
return false;
Ajax works fine and returns the data, but the problem is that Jquery can not affect the checkbox and tick them out.
It does not seem to me to be needed, but to let you know
Controller :
public JsonResult GetByID(int MailServerID)
{
var myMailServer = PublicMailServer.AllMailServer().Find(x => x.MailServerID.Equals(MailServerID));
return Json(myMailServer , JsonRequestBehavior.AllowGet);
}
All I need is this : How can I return the True and False database and affect the CheckBox?
Thanks!!!
Aucun commentaire:
Enregistrer un commentaire