私は twitter のブラッドハウンド提案エンジンを使用しています。以下は私が使用しているコード スニペットです。
// instantiate the bloodhound suggestion engine
var searchData = new Bloodhound({
datumTokenizer: function (d) {
return Bloodhound.tokenizers.whitespace(d.value);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: 'http://localhost/address/fetch?q=%Query' //Local URL
}
});
// initialize the bloodhound suggestion engine
searchData.initialize();
// instantiate the typeahead UI
$('.typeahead').typeahead({
hint:false,
highlight: true,
minLength: 3
}, {
name:'search-data',
displayKey: 'title',
source: searchData.ttAdapter(),
templates: {
suggestion: Handlebars.compile('<p><strong>{{title}}</strong></p>')
}
});
上記のコード スニペットで述べたように、Ajax リクエストは起動しません。jQuery 検証プラグインがページに含まれていなければ、正常に動作しています。
この問題を克服するには?
更新:
jQuery 検証プラグインを 1.7 から最新 (1.12) にアップグレードしたところ、問題は修正されましたが、この背後にある理由はわかりません。誰かが正確な理由を知っている場合は、回答を投稿してください。