現在、このオートコンプリートオプションがあります:
<script type="text/javascript">
$().ready(function () {
$("#tags").autocomplete(["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"], {
width: 320,
max: 4,
highlight: false,
multiple: true,
multipleSeparator: " ",
scroll: true,
scrollHeight: 300
});
});
</script>
<body> <p>
<label>Tags (local):</label>
<input type="text" id='tags' />
</p>
</body>
しかし、アクションメソッドからこの配列を取得したいと思います: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", 「scala」、「groovy」、「haskell」、「pearl」]。たとえば、コントローラー「検索」のアクション「クイック検索」から。
だから、このようなもの:
public ActionResult QuickSearch(string term)
{
IEnumerable<string> list = test();
return Json(list, JsonRequestBehavior.AllowGet);
}
助言がありますか?