Answer the question
In order to leave comments, you need to log in
Can't read local json file. What's wrong?
Hello. I'm trying to run an example for 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>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question