HomeController.cs
public JsonResult Getjosn(int pid)
{ return Json(Area(pid)); } public IEnumerable<HuiyuanInfo> Area(int pid) { return from c in db.HuiyuanInfo where c.ID == pid select c; }Home/Index.aspx
function GetArea(pid, obj) {
$.getJSON("/Home/Getjosn", { pid: pid }, function(data) { $(obj).empty(); $(obj).append("<option value='0'>请选择</option>"); $(data).each(function(i, item) { $(obj).append("<option value='" + item.Huiyuan_ID + "'>" + item.Huiyuan_name + "</option>"); }); }); }<select id="Select1" οnchange="GetArea(this.value,'select[name=\'City\']')">
<option value="">请选择省份</option> <option value="1">fdfd</option> <option value="2">fdfd</option> </select> <select name="City" class="require" check="num"> <option value="">请选择城市</option> </select>