在我的Ruby on Rails应用程序中,我使用的是简单的自动填充字段。经过一段时间没有任何理由它停止工作,几个月前一切都很好。
Google Chrome控制台错误:
Uncaught TypeError: Cannot read property 'PAGE_UP' of undefined
我包括js / css库的方式:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/jquery-ui.min.js" type="text/javascript"></script>
JS:
$('#game_title').autocomplete({
source: "/ajax/games",
select: function( event, ui ) {
$("#game_id").val(ui.item.id)
}
});
term = Knight的JSON输出:
[{"label":"Knight Online","title":"Knight Online","id":39},{"label":"BattleKnight","title":"BattleKnight","id":558},{"label":"Remnat Knights","title":"Remnat Knights","id":2088},{"label":"Spiral Knights","title":"Spiral Knights","id":2113},{"label":"Knight Age","title":"Knight Age","id":2466}]