我正在使用 JQuery 和 Rails 开发一个自动完成表单。但是我不知道如何将值从我的数据库中提取到 JQuery(我相信这必须通过 Rails 完成)。
这是我在 jQuery 中的自动完成功能
<script>
$(document).ready(function() {
$( "#BOOKSEARCH" ).autocomplete({
source: programmingLang
});
});
var programmingLang = ["ActionScript","AppleScript","Asp","BASIC","C","C++",
"Clojure","COBOL","ColdFusion","Erlang","Fortran","Groovy","Haskell",
"Java","JavaScript","Lisp","Perl","PHP","Python","Ruby","Scala","Scheme"];
</script>
然而,目前自动完成从硬编码数组中填充。如何用 Rails 中的数据值填充这个数组?
谢谢