I'm under the impression that I don't need to use bloodhound when performing a remote call. I've tried running this code:
$("#iban2").typeahead({
hint: false,
minLength: 4,
highlight: true
},
{
source: function show(q, cb, cba) {
console.log(q);
var url = '@Url.HttpRouteUrl("DefaultApi", new {controller = "Iban"})' + "/" + q;
$.ajax({ url: url })
.done(function(res) {
cba(res);
})
.fail(function(err) {
alert(err);
});
},
displayKey: 'iban'
});
Even though I get the results, calling the async cb from within the source function still does not work. Any tips on what's going on?
Thanks.
Luis
Not sure why, but adding the limit option seems to solve the problem:
$("#iban2").typeahead({
hint: false,
minLength: 4,
highlight: true
},
{
source: function show(q, cb, cba) {
console.log(q);
var url = '@Url.HttpRouteUrl("DefaultApi", new {controller = "Iban"})' + "/" + q;
$.ajax({ url: url })
.done(function(res) {
cba(res);
})
.fail(function(err) {
alert(err);
});
},
limit:10,
displayKey: 'iban'
});