2
Я пытаюсь реализовать typeahead.js
автозаполнения/поиск с учетом ASP MVC, но в консоли в Chrome, при загрузке страницы я получаю сообщение об ошибке:Typeahead.js - Не удается прочитать свойство «IsArray» неопределенного
Uncaught TypeError: Cannot read property 'isArray' of undefined ... typeahead.js:26
Это часть кода в typeahead.js файл, он имеет в виду
isString: function(obj) {
return typeof obj === "string";
},
isNumber: function(obj) {
return typeof obj === "number";
},
isArray: $.isArray, <-UncaughtTypeError: Cannor read property of 'isArray' of undefined
isFunction: $.isFunction,
isObject: $.isPlainObject,
isUndefined: function(obj) {
return typeof obj === "undefined";
},
Вот typeahead
код вместе с декларациями я использую.
<script src="http://twitter.github.io/typeahead.js/releases/latest/typeahead.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.typeahead').typeahead({
source: function (term, process) {
var url = '@Url.Content("~/Home/GetNames")';
return $.getJSON(url, { term: term }, function (data) {
return process(data);
});
}
});
});
</script>
А вот входной элемент используется для поиска
<form class="navbar-search pull-left">
<input type="text" value="" id="typeahead" data-provide="typeahead" class="search-query" /> @*placeholder=" Agent search" />*@
</form>