我正在尝试使用 jqueryUI 自动完成功能,其中可用的标签将从后端源中获取。这是我的代码。
代码
<div class="span4 pull-right">
Search : <input type="text" id="search" placeholder="Search">
</div>
js代码
<script>
$(function() {
$( "#search" ).autocomplete({
source: "/dashboard/search"
});
});
</script>
djangoviews.py
def search(request):
availableTags = ["ActionScript","AppleScript","Asp","BASIC","C","C++","Clojure","COBOL","ColdFusion","Erlang"];
data = simplejson.dumps(availableTags)
return HttpResponse(data)
我的可用标签被返回,但可用标签的过滤不起作用。它显示了可用标签的完整列表。我哪里错了?