$(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("
", 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("
", list), "text/text");
//return Json(list, JsonRequestBehavior.AllowGet); ;
}
- <div style="position:relative;">
- <span style="margin-left:100px;18px;overflow:hidden;">
- <select style="118px;margin-left:-100px" onchange="this.parentNode.nextSibling.value=this.value">
- <option value="天蓝蓝">天蓝蓝</option>
- <option value="草绿绿">草绿绿</option>
- <option value="水清清">水清清</option>
- </select></span><input name="box" style="100px;position:absolute;left:0px;">