//科室改变,级联医生 js $("#DepartmentId").change(function () { if (isNaN($(this).val())) { $("#DoctorId option:gt(0)").remove(); } else { $.post(‘/JK/Json/JsonDoctorList/‘, { departmentId: $(this).val() }, function (data) { if (data.Success) { $("#DoctorId option:gt(0)").remove(); $.each(data.Content, function (i, o) { $("<option />").text(o.Name).val(o.Id).appendTo("#DoctorId"); }); } else { $.alert(data.ErrorMessage); } }); } }); ///////controller action public ActionResult JsonDoctorList(int? departmentId ) { JsonData ret = new JsonData(); JkDoctorRepository rep = new JkDoctorRepository(); try { if (departmentId.HasValue) { ret.Content = rep.FindByDepartmentId(departmentId.Value); } } catch (Exception ex) { ret.Success = false; ret.ErrorMessage = ex.Message; } return Json(ret); }