@SvetlanaDubovik

Не могу считать локальный json файл. Что не так?

Здравствуйте. Пытаюсь запустить пример для twitter typeahead.

<script type="text/javascript">
$(document).ready(function(){
    // Sonstructs the suggestion engine
    var countries = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.whitespace,
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        // The url points to a json file that contains an array of country names
        prefetch: '/test/countries.json'
    });
    
    // Initializing the typeahead with remote dataset
    $('.typeahead').typeahead(null, {
        name: 'countries',
        source: countries,
        limit: 10 /* Specify maximum number of suggestions to be displayed */
    });
});  
</script>
</head>
<body>
    <div class="bs-example">
		<h2>Enter your country name</h2>
        <input type="text" class="typeahead tt-query" autocomplete="off" spellcheck="false">
    </div>
</body>


Но данный пример у меня не работает. Если в браузере попробовать найти 192.168.0.103/test/countries.json, находит, но скрипт не работает. Что не так? В качестве сервера использую xampp
  • Вопрос задан
  • 414 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы