我是 Jquery 的新手,在实现此方法自动完成时遇到问题:来自此URL。
我收到这个错误
:Uncaught TypeError: Object [object Object] has no method 'autocomplete'
在我的代码的 javascript 部分:
代码: index.html:
<html>
<head>
<style type="text/css">
body{font:62.5% Verdana,Arial,sans-serif;}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="function.js"></script>
</head>
<body>
<input id="autocomplete"/>
</body>
</html>
代码:function.js
$(document).ready(function() {
$( "#autocomplete" ).autocomplete({
source: function( req, resp ) {
$.post( "/echo/json/", {
json: '["1", "2", "3", "4", "5"]',
delay: 1
}, function(data) {
resp( data );
}, "JSON" );
}
});
});
问题:我是否遗漏了需要链接到的任何重要文件或外部文件/库?