【发布时间】:2014-09-21 17:59:04
【问题描述】:
我在使用 JQuery 自动完成文本时遇到问题。我使用了 ChromeBug,一切看起来都很好。文本正在发送到控制器,我在那里设置断点以查看他得到的内容,并且一切看起来都很好。 但在文本框中我没有任何建议。
我的控制器看起来像这样:
public JsonResult AutocompleteTowns(string term) {
return this.Json(db.Miastoes.Where(x => x.Nazwa.StartsWith(term)).ToString(), JsonRequestBehavior.AllowGet);
}
脚本:
$(document).ready(function () {
$('#nazwaMiasta').autocomplete({
source: '@Url.Action("AutocompleteTowns", "Administrator")'
});
)};
你有什么想法吗?
【问题讨论】:
标签: asp.net-mvc jquery-autocomplete