<script type="text/javascript" language="javascript">
$(function () {
$("#name-list").autocomplete({
source: function (request, response) {
$.ajax({
url: "/home/findnames", type: "POST", dataType: "json",
data: { searchText: request.term, maxResults: 10 },
success: function (data) {
response($.map(data, function (item) {
return { label: item.FullName, value: item.FullName, id: item.PersonId }
}))
}
})
},
select: function (event, ui) {
$.ajax({
url: "/home/insert", type: "POST", data: { id: ui.item.id },
success: function (data) { $("#display-list").html(data); }
})
}
});
});
</script>
|