typeahead.js을 사용하려고합니다. 내 코드는 다음과 같습니다선행 기입 제어가 작동하지 않습니다.
<input id="query" type="search" class="form-control typeahead tt-query" autocomplete="off" spellcheck="false" placeholder="Search by typing anything" />
...
var URL_ROOT = '[populated on server. Something like "http://localhost:8080"]';
var suggestions = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: URL_ROOT + '/api/suggestions?querytext=%QUERY'
});
suggestions.initialize();
$(document).ready(function() {
$('input.typeahead').typeahead({
source: suggestions.ttAdapter()
});
});
페이지가로드, 내가 하지을 수행 할 때 콘솔 창에 오류를 참조하십시오. 필자가 입력 한대로 Fiddler에서 서버에 대한 요청을 볼 수 없습니다. 나는 제안을 찾기 위해 서버에 요청을하는 것을보기 위해 타이핑 할 때 기대할 것이다. 내가 도대체 뭘 잘못하고있는 겁니까?
Typeahead 인스턴스로 전달할 JSON의 샘플을 포함시킬 수 있습니까? –
내 대답이 왜 현상금을 얻지 못했는지 말해 줄 수 있습니까? 처음이자 올바른 대답이었습니다 – arisalexis
@arisalexis - 다른 대답은 더 완전했습니다. – user70192