2017-01-17 2 views
0

jquery를 사용하여 장고에서 자동 완성 검색 입력을 구현하려고합니다.jquery 자동 완성이 정의되지 않았습니다.

이 문제와 관련하여 비슷한 질문을 많이했으나 구체적인 사례는 없습니다. 내 base.html 클래스에서

나는이처럼 보이는 head 있습니다

나는 head에 다음 한 base.html를 확장 내 home.html 클래스에서 다음

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> 
 
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

:

<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" type="text/css" media="all"/> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
home.html 파일의 <body>에서 다음 3,739,

내가 가진 : enter image description here

home.html I에 갈 때 :

<input name="object-search"class="form-control "id="search"> 
 
<script type="text/javascript"> 
 
    $(function() { 
 
     $("#search").autocomplete({ 
 
      source: "/api/", 
 
      minLength: 1, 
 
     }); 
 
    }); 
 

 
</script>

home.html 순서에서

은 다음과 같습니다 다음과 같은 오류가 발생합니다. 또는 : enter image description here

+0

'jQuery' 라이브러리도 첨부 했습니까? – marian0

+0

자바 스크립트 사용에 대한 무지를 용서해주세요.하지만이 줄의 의미는 다음과 같습니다.' cph2117

+0

젠장, 미안해. 어떻게 든 그리워. 하지만 확실히 'home.html'에 첨부되어 있는지, 위의'jquery.ui'에 첨부되어 있는지 확인할 수 있습니까? – marian0

답변

0

매우 멍청한 오류. 내 base.html 파일 하단에 여분의 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 이 있었으므로 다른 가져 오기를 무시/무효화해야합니다.

관련 문제