我在这段代码中遇到错误。有谁能够帮助我?
<h4>search:<input type="text" id="name-list" /></h4>
<script type="text/javascript" language="javascript">
$(function () {
$("#name-list")
.autocomplete({
source: function (request, response) {
$.ajax({
url: "/Home/Searchuser", type: "POST", dataType: "json",
data: { searchText: request.term, maxResults: 10 }
})
return false;
},
minLength: 1
}).data("autocomplete")._renderItem = function (ul, item) {
var inner_html = '<a><div class="list_item_container"><div class="image"><img src="' + item.PicLocation + '"></div><div class="label">' + item.label + '</div><div class="description">' + item.DisplayName + '</div></div></a>';
return $("<li></li>")
.data("item.autocomplete", item)
.append(inner_html)
.appendTo(ul);
};
});
</script>
数据从服务器正确接收。我在哪里犯错了?