Index.cshtml
Dosyayı İndir
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
Örnek Adı <input type="text" id="SampleName" /><b />
Başka Bir Şey <input type="text" id="AnotherThing" /><b />
@section Scripts {
<script type="text/javascript" language="javascript">
$(function () {
alert("Çağrıldı");
$("#SampleName").autocomplete({
source: function (request, response) {
$.ajax({
url: "/Complete/Suggestions", type: "POST", dataType: "json",
data: { searchText: request.term, maxResults: 10 },
success: function (data) {
response($.map(data, function (item) {
return { label: item.SampleName, value: item.SampleName, id: item.SampleId }
}))
}
})
},
select: function (event, ui) {
alert(ui.item ? ("You picked '" + ui.item.label + "' with an ID of " + ui.item.id)
: "Nothing selected, input was " + this.value);
}
});
});
</script>
}
Dosyayı İndir