jquery自动完成未定义函数

jquery自动完成未定义函数,jquery,django,Jquery,Django,我试图使用jquery autocomplete,但得到一个未定义的函数错误- html代码和js代码: $(document).ready(function(){ $("#searchtext").autocomplete({ //source: availableTags, This works.....(static list are working) source: function (request, response) { // Thi

我试图使用jquery autocomplete,但得到一个未定义的函数错误-

html代码和js代码:

$(document).ready(function(){
     $("#searchtext").autocomplete({

        //source: availableTags, This works.....(static list are working)
        source: function (request, response) {   // This is not working 
            $.ajax ({
                url: '/autosuggest/',
                data: { 'keyword':$('#searchtext').val()},
                dataType: "json",
                type: "POST",
                contentType: "application/json; charset = utf-8",
                success: function (data) {
                    return data
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                }

            });
        },
        minLength: 1,
    //open: function() { $(this).autocomplete("widget").css({"width": $(this).width()+6})},
    //appendTo:$( ".cls_comp").parent(),
        select: function( event, ui ) { }
    });
})
views.py

@csrf_exempt
def autosuggest(request):
    json_response = ['value1','value2','value3','value4']
    return HttpResponse(json_response,content_type='application/json')
错误:

 $("#searchtext").autocomplete({

Uncaught type:undefined is not a function
使用的jquery库:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />

<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>

您将包含jQuery两次。第二种方法优于第一种方法,其中包括jQueryUI方法。将脚本标记更改为:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />

<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

您将包含jQuery两次。第二种方法优于第一种方法,其中包括jQueryUI方法。将脚本标记更改为:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />

<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

所以,我必须删除-src=?,对吗?。我这样做了,但同样的问题我有另一个重复的条目。一旦我删除了它,它就工作了…谢谢,我必须删除-src=?,对吗?。我这样做了,但同样的问题我有另一个重复的条目。一旦我删除了它,它就工作了…谢谢