|
@using (Html.BeginForm())
{
@Html.EJS().CheckBox("default").Label("I agree to the Terms and Conditions").Change("onChange").Render()
}
<script>
function onChange(args) {
$.ajax({
url: "/Home/Index",
type: "POST",
datatype: "json",
contentType: "application/json; charset=utf-8",
data: JSON.stringify({ "Checked": args.checked }),
success: function (result) {
}
});
}
</script> |
|
[HttpPost]
public ActionResult Index(CheckboxState form)
{
return View();
}
public class CheckboxState
{
public bool Checked { get; set; }
} |