我有一个 asp.net mvc4 应用程序剃须刀,我想在其中添加自动完成功能,我添加了一个availableTags
具有不同值的示例表,它可以工作,但是当我尝试使用ArrayList
javascript 表时:
@{
ArrayList elements = new ArrayList();
elements=(ArrayList)Session["elements"];
}
<script>
$(function () {
var champ = "@elements";
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$("#tags").autocomplete({
source: champ
});
});
</script>
它失败!!!这个问题的原因是什么?我该如何解决?