$(function () {
//城市
$("#u_loupancity").autocomplete(具体URL)
$("#u_loupancity").blur(function () {
$("#u_loupanname").unbind();
$("#loupanid").val("");
$("#u_loupanname").val("");
//楼盘
$("#u_loupanname").autocomplete(具体URL, {
extraParams: { City: function () { return $("#u_loupancity").val(); }, cacheLength: 0 },
mustMatch: true //如果设置为true,autoComplete只会允许匹配的结果出现在输入框,所有当用户输入的是非法字符时将会得不到下拉框,Default:false
});
});
});
public ActionResult GetCityNameJson(string q)
{
q = "%" + q + "%";
List<Area> area = AreaBLL.GetCityListByName(q);
List<string> list = new List<string>();
foreach (var i in area)
{
list.Add(i.Name);
}
return Content(string.Join("\n", list), "text/text");
}
public ActionResult GetLouPanNameFromLouPanManage(string City, string q)
{
int companyEnum = Common.Common.GetUserBelongCompany();
List<string> list = new List<string>(); // List of city names
List<LouPanManage> hit = LouPanManageBLL.GetLouPanName(City, q, companyEnum);
foreach (var i in hit)
{
list.Add(i.LouPanName);
}
return Content(string.Join("\n", list), "text/text");
//return Json(list, JsonRequestBehavior.AllowGet); ;
}